Monday, March 23, 2009

FIND MAXIMUM AND MINIMUM OF NUMBERS

EXAMPLE-:------(My shortest program to find the Maximum and Minimum of given numbers)

#include
#include
void main()
{
int a[10],n,i;
long int b=1111110,k=0;
clrscr();
printf("Enter the limit:-->");
scanf("%d",&n);
printf("Enter the elements:\n");
for(i=0;ia[i])
b=a[i];
if(k<a[i])
k=a[i];
}
printf("THE MAXIMUM-->%ld\nTHE MINIMUM---->%ld",k,b);
getch();

}

No comments:

Post a Comment