How to Find Index Number of Biggest Number in Array in C++

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;
}

Output of the Program

FIND INDEX OF LARGEST NUMBER IN ARRAY in c++


Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment