C++ – Maximum and Minimum Elements C++ Language Program Code

C++ – Maximum and Minimum Value C Language Program Code

#include
#include
void main()
{
int a[5],max=a[0],i,min=a[0];
clrscr();
cout<<"Enter the elements:n";
for(i=0;i<5;i++)
{
cin>>a[i];
}
for(i=0;i<5;i++)
{
if(a[i]>max)
{
max=a[i];
}
}
cout<<"Element with maximum value:"< for(i=0;i<5;i++)
{
if(a[i] {
min=a[i];
}
}
cout<<"nElement with minimum value:"<getch();
}

Add Comment