1: #include<stdio.h>
2: #include<conio.h>
3: void main()
4: {
5: int i,n;
6: char ch;
7: float x[20];
8: float max=-1.0E38;
9: printf("\nEnter the array:\n");
10: for(i=1;i<20;i++)
11: {
12: scanf("%f%c",&x[i],&ch);
13: if(ch=='\n')
14: break;
15: }
16: n=i+1;
17: for(i=0;i<n;i++)
18: {
19: if(x[i]>max)max=x[i];
20: }
21: printf("\nThe array is:");
22: for(i=0;i<n;i++)
23: printf("%7.2f",x[i]);
24: printf("\nmaximum num is %7.2f\n",max);
25: getch();
26: }
No comments:
Post a Comment