Saturday, December 17, 2011

C Program for find the Greatest Number in an array...

#include<stdio.h>
#include<conio.h>
void main()
{
 int a[20],i, n,max;
 clrscr();
 printf("Enter the Limit:");
 scanf("%d",&n);

 if(n<=20)
    {
        printf("Enter The No for Array:");
        for(i=0;i<n;i++)
            scanf("%d",&a[i]);
   
        max=a[0];
        for(i=0;i<n;i++)
            {
                if(a[i]>=max)
                    max=a[i];
            }   
        printf("\nThe Bigest number in array is %d",max);
       
    }
   else
    printf("Enter the value of less than or equal to 20");

 getch();
       
}

No comments:

Post a Comment