Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<conio.h>
- struct gpa
- {
- char name;
- int grade;
- char letter;
- };
- void main()
- {
- int k;
- int a;
- struct gpa a;
- printf("name : ");
- scanf("%s", &a.name);
- printf("grade : ");
- scanf("%d", &a.grade);
- k = a.grade/10;
- if (k>= 9)
- a.letter ='A';
- else if (9>k && k>= 8)
- a.letter ='B';
- else if (8>k && k>=7)
- a.letter='C';
- else if (7>k && k>=6)
- a.letter='D';
- else
- a.letter ='F';
- printf("%s has the grade of %d gpa is %c\n", a.name, a.grade, a.letter);
- printf("ths size of this structure is %d byte\n", sizeof(a));
- }
Add Comment
Please, Sign In to add comment