This is the simple but logical Array exercise for beginners in C++. The program will find the index number of biggest digit in a given array.
Source Code
#include<iostream> using namespace std; int main () { int num[5]; int a; int index; for ( int i =0; i<5;i++ ) { cout<<" Enter Your Number : "; cin>>num[i]; } for (int i =0; i <5;i++) { if (num[i]>a) { a = num [i]; index = i; } } cout<<" The Index of Biggest Number is : "<<index; }
0 comments:
Post a Comment