/*
In this program
grades and their points are X=10,A=8,B=7,C=6,D=5,E=4
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int c[20],gp[20],i,sum=0,csum=0,n;
char g[20];
float cgpa;
clrscr();
printf("\n\t\t\t CGPA Calculation");
printf("\n\n Enter number of Courses :");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n\n Enter Grade of Course-%d :",i+1);
scanf("%c",&g[i]);
if(g[i]=='X'||g[i]=='x')
gp[i]=10;
else if(g[i]=='A'||g[i]=='a')
gp[i]=8;
else if(g[i]=='B'||g[i]=='b')
gp[i]=7;
else if(g[i]=='C'||g[i]=='c')
gp[i]=6;
else if(g[i]=='D'||g[i]=='d')
gp[i]=5;
else if(g[i]=='E'||g[i]=='e')
gp[i]=4;
else
gp[i]=0;
printf("\n\n Enter credits to Course-%d :",i+1);
scanf("%d",&c[i]);
}
for(i=0;i<n;i++)
{
sum=sum+c[i]*gp[i];
csum=csum+c[i];
}
cgpa=(float)sum/csum;
clrscr();
printf("\n\n\n\n\n\n\t\tCongratulations\n\n\t\t\t\t Your CGPA is \"%f\" ",cgpa);
getch();
}
/*In this program you can calculate CGPA of 20 courses*/
In this program
grades and their points are X=10,A=8,B=7,C=6,D=5,E=4
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int c[20],gp[20],i,sum=0,csum=0,n;
char g[20];
float cgpa;
clrscr();
printf("\n\t\t\t CGPA Calculation");
printf("\n\n Enter number of Courses :");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n\n Enter Grade of Course-%d :",i+1);
scanf("%c",&g[i]);
if(g[i]=='X'||g[i]=='x')
gp[i]=10;
else if(g[i]=='A'||g[i]=='a')
gp[i]=8;
else if(g[i]=='B'||g[i]=='b')
gp[i]=7;
else if(g[i]=='C'||g[i]=='c')
gp[i]=6;
else if(g[i]=='D'||g[i]=='d')
gp[i]=5;
else if(g[i]=='E'||g[i]=='e')
gp[i]=4;
else
gp[i]=0;
printf("\n\n Enter credits to Course-%d :",i+1);
scanf("%d",&c[i]);
}
for(i=0;i<n;i++)
{
sum=sum+c[i]*gp[i];
csum=csum+c[i];
}
cgpa=(float)sum/csum;
clrscr();
printf("\n\n\n\n\n\n\t\tCongratulations\n\n\t\t\t\t Your CGPA is \"%f\" ",cgpa);
getch();
}
/*In this program you can calculate CGPA of 20 courses*/
If there are any mistakes
ReplyDeleteplease comment them
I will update it
It shows me your program need an input
DeleteHow i can calculate Cgpa of 2 semester
ReplyDelete