Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main(){
- struct student{
- char name[30];
- int eng;
- int math;
- double mean;
- }std[3];
- int i=0;
- int engmax=-1;
- int engmaxname=0;
- char higheareng[30];
- while(i<3){
- printf("enter your name [%d]: ",i+1);
- scanf("%s",&std[i].name);
- printf("enter your point eng [%d]: ",i+1);
- scanf("%d",&std[i].eng);
- printf("enter your point math [%d]: ",i+1);
- scanf("%d",&std[i].math);
- printf("student[%d] : name : %s \npoint eng : %d \npoint math : %d\n",i+1,std[i].name,std[i].eng,std[i].math);
- i++;
- }
- i=0;
- while (i<1){
- printf("mean : %d \n",(std[i].math+std[i+1].math+std[i+2].math)/3);
- i++;
- }
- i=0;
- while (i<3){
- if(engmax<std[i].eng){
- engmax=std[i].eng;
- //strcpy(higheareng, std[i].name);
- engmaxname=i;
- }
- i++;
- }
- //printf("name eng max : %s\n",higheareng);
- printf("name eng max : %s\n",std[engmaxname].name);
- printf("point eng max : %d\n",engmax);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment