Friday, 11 December 2015

write a program that inputs 10 numbers as elements of array and tells the maximum and minimum number ....c++

#include<iostream>
using namespace std;
main()
{ int array[10],max,min;
cout<<"Enter Array Elements";
for(int a=0;a<10;a++)
cin>>array[a];
max=min=array[0];
for(int a=0;a<10;a++)
{
if(array[a]>max)
{ max=array[a];
}
if(array[a]<min)
min=array[a];
}

cout<<"the greater number is:"<<max<<endl;
cout<<"the minimum number is:"<<min;

}

No comments:

Post a Comment