Created
April 18, 2020 10:23
-
-
Save IAFahim/a7f1506923d7e728883b49ef0c908dcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<string.h> | |
struct student | |
{ | |
char name[25];int id;int cgpa; | |
};int i=0; | |
struct student scan_and_print(); | |
void main(){ | |
struct student one=scan_and_print(); | |
struct student two=scan_and_print(); | |
two.cgpa>one.cgpa ? printf("%s",two.name):printf("%s",one.name); | |
} | |
struct student scan_and_print(){ | |
struct student any; | |
printf("%d. Name: ",++i); | |
fflush(stdin); | |
gets(any.name); | |
printf("%d. Id: ",i); | |
scanf("%d",&any.id); | |
printf("%d. CGPA: ",i); | |
scanf("%d",&any.cgpa); | |
return any; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment