Skip to content

Instantly share code, notes, and snippets.

@IAFahim
Created April 18, 2020 10:23
Show Gist options
  • Save IAFahim/a7f1506923d7e728883b49ef0c908dcb to your computer and use it in GitHub Desktop.
Save IAFahim/a7f1506923d7e728883b49ef0c908dcb to your computer and use it in GitHub Desktop.
#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