Created
November 4, 2022 19:11
-
-
Save mdmarufsarker/91ede0dd8bdbe2a5b248fa65d9abca13 to your computer and use it in GitHub Desktop.
GPA Calculator for Green University Of Bangladesh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Written by: Md. Maruf Sarker | |
// Platform: VSCODE | |
// Problem: GPA Calculator | |
// Language: cpp | |
// Date: 2022-11-05 | |
#include <bits/stdc++.h> | |
using namespace std; | |
int main(){ | |
float credit[100], Acredit[100]; | |
int n; | |
float sum[100], gpa = 0; | |
cout << "Enter the number of subject you take in your current semester: "; | |
cin >> n; | |
float totalCredit; | |
cout << "Enter the total credit: "; | |
cin >> totalCredit; | |
cout << endl; | |
for(int i = 0; i < n; i++){ | |
cout << "Enter the current credit and actual credit of subject " << i + 1 << " : "; | |
cin >> credit[i] >> Acredit[i]; | |
cout << endl; | |
} | |
for(int i = 0; i < n; i++){ | |
cout << credit[i] << " " << Acredit[i] << endl; | |
sum[i] = credit[i] * Acredit[i]; | |
} | |
float s = 0; | |
for(int i = 0; i < n; i++){ | |
s += sum[i]; | |
} | |
cout << "Total Current GPA = " << s << endl; | |
gpa = s / totalCredit; | |
cout << "Your GPA is: " << gpa << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment