Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

Find the largest element in an array.

  #include<stdio.h>  
    #incliude<conio.h>  
     int main()  
    {  
     int a[50],size,i,j;  
     printf("\nEnter the size of the array: ");  
     scanf("%d",&size);  
     printf("\nEnter %d elements in to the array: ”, size);  
     for(i=0;i<size;i++)  
      scanf("%d",&a[i]);  
      j=a[0];  
      for(i=1;i<size;i++)  
       {  
       if(j<a[i])  
       j=a[i];  
     }  
     printf("\nBiggest: %d",j);  
     return 0;  
   } 

 

Post a Comment

0 Comments