Solution:NIIT/GNIIT Sonugiri0032@gmail.com

Wednesday, January 06, 2016

FIND INDEX OF LARGEST NUMBER IN ARRAY in c++

FIND INDEX OF LARGEST NUMBER IN ARRAY in c++


Structure of the Problem Requirements  

The Program find the biggest index number of an array in C++ Program. The user will enter five numbers in array and then find the biggest number in them .

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

Share:

0 comments:

GNIITSOLUTION GNIIT SOLUTION. Powered by Blogger.

Translate

Blog Archive

Unordered List