#include<stdio.h> #include<conio.h> void main() { clrscr(); int large, arr[50], size, i; printf("Enter Array Size (max 50) : "); scanf("%d",&size); printf("Enter array elements : "); for(i=0; i<size; i++) { scanf("%d",&arr[i]); } printf("Searching for largest number ...\n\n"); large=arr[0]; for(i=0; i<size; i++) { if(large<arr[i]) { large=arr[i]; } } printf("Largest Number = %d",large); getch(); }
C Program to find largest element in array.
Reviewed by
on
December 25, 2019
Rating:
No comments: