#include <stdio.h> int xyz (int); int main () { int m1,m2,m3,m4,m5,c1,c2,c3,c4,c5; int gp1,gp2,gp3,gp4,gp5,tc; float tgp,gpa; printf("Enter Marks Of Subject 1:\n"); scanf("%d",&m1); gp1=xyz(m1); printf("Enter Credit hOurs Of Subject 1\n"); scanf("%d",&c1); printf("Enter Marks Of Subject 2:\n"); scanf("%d",&m2); gp2=xyz(m2); printf("Enter Credit hOurs Of Subject 2\n"); scanf("%d",&c2); printf("Enter Marks Of Subject 3:\n"); scanf("%d",&m3); gp3=xyz(m3); printf("Enter Credit hOurs Of Subject 3\n"); scanf("%d",&c3); printf("Enter Marks Of Subject 4:\n"); scanf("%d",&m4); gp4=xyz(m4); printf("Enter Credit hOurs Of Subject 4\n"); scanf("%d",&c4); printf("Enter Marks Of Subject 5:\n"); scanf("%d",&m5); gp5=xyz(m5); printf("Enter Credit hOurs Of Subject 5\n"); scanf("%d",&c5); tgp=(gp1*c1)+(gp2*c2)+(gp3*c3)+(gp4*c4)+(gp5*c5); tc=c1+c2+c3+c4+c5; gpa=tgp/tc; printf("GPA=%.1f",gpa); } int xyz (int m) { int y,gp; y=m/10; switch (y) { case 10: case 9: case 8: gp=4; break; case 7: gp=3; break; case 6: gp=2; break; case 5: gp=1; break; case 4: case 3: case 2: case 1: gp=0; break; default: break; } return gp; }
Most Popular
-
Befunge: Developed by : Chris Pressey Year: 1993 Stack-based, reflective, esoteric programming language.
-
-
The list below is an unordered list. You can pick any book you like, and some of the books don’t even cover a programming language at all,...
-
Recursion happens when function calls itself directly or indirectly.
Copyrights © 2016 Codzya. Powered by Blogger.
Wednesday, May 11, 2016
Subscribe to:
Post Comments (Atom)
Recent
Weekly
-
Befunge: Developed by : Chris Pressey Year: 1993 Stack-based, reflective, esoteric programming language.
-
-
The list below is an unordered list. You can pick any book you like, and some of the books don’t even cover a programming language at all,...
-
Recursion happens when function calls itself directly or indirectly.
-
1- The C Programming Language This book is a comprehensive guide to the finalized ANSI standard C language programming. It has b...
Comment
Get this Recent Comments Widget
!->
0 Comment to "Calculate GPA Of Five Subjects."
Post a Comment