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