#include<stdio.h> #include<conio.h> void main() { int a[10]; int i,n,max; printf("enter the n value"); scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } max=a[0]; min=a[0]; for(i=1;i<n;i++) { if(a[i]>max) { max=a[i]; } if(a[i]<min) { min=a[i]; } } printf("%d\n%d",max,min); getch(); }
C Program To Find Min and Max element in Array
January 02, 2015
By:
Bhanu Namikaze
Bhanu Namikaze
Bhanu Namikaze is an Ethical Hacker, Security Analyst, Blogger, Web Developer and a Mechanical Engineer. He Enjoys writing articles, Blogging, Debugging Errors and Capture the Flags. Enjoy Learning; There is Nothing Like Absolute Defeat - Try and try until you Succeed.
No comments:
Post a Comment