Monday 10 February 2020

CPP program to display the 5 elements of an array of size 10 using loop from backwards

Source Code:
#include<iostream>
using namespace std;
int main()
{
int b[10]={0,1,2,3,4,5,6,7,8,9};
cout<<"view the numbers upto 5 from backwards: ";
for(int j=9;j>=5;j--)
{
cout<<b[j];
}
return 0;
}

Program Output:

No comments:

Post a Comment