Sunday, 5 June 2011

Find Maximun number in the array programm in c++

#include<iostream.h>
void main()
{
int a[2000], n,i, cmax;
cout<<"n : "; cin>>n;
cout<<"\n";
cout<<" Enter Array: "<<endl;
for(i=0;i<n;i++)
{
cout<<"["<<i<<"] : ";
cin>>a[i];
}
 cmax = a[0];
 for(i=1;i<=n-1;i++)
 {
 if(cmax<a[i])
 {cmax = a[i];
 }

 }
 cout<<"maximum number : "<<cmax;
}
Editing & programm by "Shojib"

No comments:

Post a Comment