#include <stdio.h>
02
03
04
05
06
07 int main()
08 {
09
10 int i;
11 int a[10]={1,2,3,4,5,6,7,8,9,10};
12 float sum=0;
13 float average=0;
14 int max=0,min=a[0];
15 int odd,even;
16
17 for(i=0;i<5;i++){
18 printf("enter no: ");
19 scanf("%d",&a[i]);
20 sum+=a[i];
21 }
22 for(i=0;i<5;i++){
23 if(a[i]%2==0)
24 printf("even: %d",even);
25 if(a[i]%2==1)
26 printf("odd: %d",odd);
27 }
28 for(i=0;i<5;i++){
29 if(a[i]>max){
30 max=a[i];
31 }
32 else if(a[i]<=min){ /** my problem is this part,it should give the minimum
integer as what the user enter but it always give
min=0 can anyone edit this part or the code in getting
max and min**/
33 min=a[i];
34 }
35 }
36 printf("max: %d\n",max);
37 printf("min: %d\n",min);
38
39 printf("sum: %.1f",sum);
40 average=sum/10;
41 printf("average: %1.f",average);
42
43
44
45 return(EXIT_SUCCESS);
46 }
This post has been edited by ishkabible: 03 February 2011 - 01:58 PM
Reason for edit:: use code tags and dont copy the line numbers

New Topic/Question
Reply
MultiQuote











|