#include<iostream>
using namespace std;
int main()
{
int num[10] = { 1,2,3,4,5,6,7,8,9,10 };
for (int i = 0; i < 10; i++)
{
if (num[i] > num[i + 1])
cout <<“Array elements ” << i << ” and ” << i + 1<< ” are out of ordern”;
}
return 0;
}
I want to check whether my code is in ascending order, but italways show “Array element 9 and 10 are out of order” which isincorrect.
What is the error in my code and how to fix it?
Expert Answer
An answer will be send to you shortly. . . .
PayPal Gateway not configured
PayPal Gateway not configured