#include<iostream>
using namespace std;
int main()
{
int array[10],n,temp=0; // initilize the variables
cout<<"Enter no of element :";
cin>>n;
for(int i=1;i<=n;i++) //loop for enter the array element
{
cout<<"Enter element no "<<i<<" is : ";
cin>>array[i];
}
for(int i=1;i<=n;i++) //loop for showing array element
{
cout<<"elements are:"<<array[i]<<endl;
}
for(int i=1;i<=n;i++)
{
if(array[i]>temp)
temp=array[i];
}
cout<<"Greatest no is: "<<temp;
}
cout<<temp;
}
using namespace std;
int main()
{
int array[10],n,temp=0; // initilize the variables
cout<<"Enter no of element :";
cin>>n;
for(int i=1;i<=n;i++) //loop for enter the array element
{
cout<<"Enter element no "<<i<<" is : ";
cin>>array[i];
}
for(int i=1;i<=n;i++) //loop for showing array element
{
cout<<"elements are:"<<array[i]<<endl;
}
for(int i=1;i<=n;i++)
{
if(array[i]>temp)
temp=array[i];
}
cout<<"Greatest no is: "<<temp;
}
cout<<temp;
}
0 comments:
Post a Comment