//(WAP to find maximum number an integer array.) #include<stdio.h> #include<conio.h> void main() { int a[10],i,n,k; clrscr(); printf("\nEnter the number:"); scanf("%d",&n); for(i=0;i<n;i++) { printf("\nEnter elements:",i+1); scanf("%d",&a[i]); } k=a[0]; for(i=0;i<n;i++) { if(k<a[i+1]) { k=a[i+1]; } } printf("\nMaximum:%d",k); getch(); }
No comments:
Post a Comment