Skip to main content

Finding The MAX Element Of The Array

#include<iostream>
#include<conio.h>
#include
#include
void main()
{
clrscr();
int i,a[10],max=0;
printf("enter the 10 values");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<10;i++)
{
if(a[0]>0
a[i]>max
max=a[i];
max=10
}
printf("max is %d",max);
getch();
}

Comments

Popular posts from this blog

C++ Program Finding The Absolute Value

#include<iostream> using namespace std; int main() { cout<<" enter any number"; cin>>num; if(num>0) { cout<<"The absolute value of number is:"<< num; } else { cout<<"The absolute value of number is :"<< -(num); } return 0; } OUTPUT Enter Any number: 2 The absolute value of number is 2