#include<stdio.h> main() { int a[30],i,large,small,n; printf("enter your limit\t"); scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); small=large=a[0]; for(i=0;i<n;i++) { if(a[i]<small) small=a[i]; if(a[i]>large) large=a[i]; } printf("large=%d",large); printf("small=%d",small); }
Friday, 10 February 2012
how to find largest and smallest from a set of numbers
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment