Thursday, July 21, 2011

A C program that can find CGPA

This is the program to make a formula to find the CGPA of four semester. This program will takes input GPA of four semester and then find the CGPA and print it on the screen.

C Program:




#include<stdio.h>
#include<conio.h>
void main(void)
{
//*program that can calculate cgpa of four smesters
float gpa1,gpa2,gpa3,gpa4,cgpa;
clrscr();
printf("Enter your first gpa=");
scanf("%f",&gpa1);
printf("\nEnter your 2nd gpa=");
scanf("%f",&gpa2);
printf("\nEnter your 3rd gpa=");
scanf("%f",gpa3);
printf("\nEnter your 4rth gpa=");
scanf("%f",&gpa4);
cgpa=(gpa1+gpa2+gpa3+gpa4)/4;
printf("\nYour CGPA is %f",cgpa);
getch();
}


Output:-
                   Enter your first gpa = 3.82
                   Enter your 2nd gpa = 4
                   Enter your 3rd gpa= 3.9
                   Enter your 4th gpa= 4
                   
                   Your CGPA is 3.93

2 comments:

  1. Thanks a lot.................Afzal vai.

    ReplyDelete
  2. How can I count CGPA for 60 studets using file and structure.

    ReplyDelete