Answer to Question #297641 in C for Vmarxl

Question #297641

Write a code in C language to Calculate average CGPA with grade and score

1
Expert's answer
2022-02-14T18:33:36-0500
#define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h>
#include <stdio.h>






void calculateCGPA();




int main()
{
    system("cls");
    calculateCGPA();
   
}




void calculateCGPA()
{
    int l;
   printf("-------------- CGPA Calculating -----------------\n\n\n");
       printf("How many semester results do you want input? :");
    scanf("%d",&l);
    printf("\n\n\n");
    float *semrs = new float [l];
    int i;


    for (i = 0; i < l; i++)
    {
        printf(" Enter Semester %d Result(GPA): " , i+1);
        scanf("%f", &semrs[i]);
        printf("\n\n");
    }


    float semtot = 0;
    for (int j = 0; j < l; j++)
    {
        semtot = semtot + semrs[j];
    }


    printf("******** Your CGPA is %f **********\n", (float)(semtot / l));


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS