You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
795 B

#include<stdio.h>
int main(){
printf(" 1.Input\n");
printf(" 2.Output\n");
printf(" 3.Order\n");
printf(" 4.Quit\n");
char a;
scanf("%c",&a);
if(a=='i'){
printf("Please input info of the three students:\n");
}else if(a=='o'){
printf("You are trying to Output info\n");
}else if(a=='m'){
printf("You are trying to Make things ordered\n");
}else if(a=='q'){
printf("You are about to Quit\n");
}else{
printf("Wrong input");
}
float num[3][4];
int l;
for(l=0;l<3;l++){
int k;
for(k=0;k<4;k++){
scanf("%f",&num[l][k]);
}
}
int i;
for( i=0;i<3;i++){
float sum=0;
int j;
for(j=1;j<4;j++){
sum+=num[i][j];
if(j==3){
printf("%.0f,%.1f,%.1f\n",num[i][0],sum,sum/3);
}
}
}
}