#include<iostream>
using namespace std ;
int main()
{
int array[100],maximum,size,c,location=1;
cout<<"enter the elements in array\n";
cin>>size;
cout<<"enter"<<ends<<size<<ends<<"integers\n";
for(c=0;c<size;c++)
cin>>array[c];
maximum=array[0];
for(c=1;c<size;c++)
{
if(array[c]>maximum)
{
maximum=array[c];
location=c+1;
}
}
cout<<"maximum element is present at location"<<ends<<location<<ends<<"and its value is "<<ends<<maximum<<"\n";
return 0;
}
No comments:
Post a Comment