Computer Science, asked by jaiswalishant1218, 1 year ago

C program to find largest of n numbers using while loop

Answers

Answered by Geekydude121
2

The program to find greatest of n elements is:-

#include <stdio.h>


 

int main()


{


 

       int a[50], s, i, large;


 

       printf("\n Enter the size of the array: ");


scanf("%d", &s);


 

       printf("\n Enter %d elements: ", s);


 

       for (i = 0; i < s; i++)


 scanf("%d", &a[i]);


 

       largest = a[0];


 

       while(i>0)  

       {


 if (large < a[i])


  large = a[i];


}


 

       printf("\n the largest number in a array is %d", largest);


 

       return 0;


 

}



Answered by kayamtejaswi2004
1

Explanation:

follow this method kkkk

Attachments:
Similar questions