0
Full Question is in Description
Suppose here is class of 10 students who have CGPA between 0-10.The university has decided to give the grace for those students those who bave the CGPA between 4.5 to 4.9 t0 make it 5. Identify the students those have CGPA after adding the grace marks. Suppose students have its Roll_no &CGPA. Add the grace CGPA to the obtained CGPA of student by adding grace of5 marks iste the students through array. Input The input should contains a roll_oaed CGPA of the students.
5 ответов
+ 3
Your program have not any Compile time errors. Try to run again
#include <iostream>
using namespace std;
double CgpaCalc(double marks[], int n){
double grade[n];
double cgpa, sum = 0;
for(int i = 0; i < n; i++)
{
grade[i] = (marks[i] / 10);}
for(int i = 0; i < n; i++)
{
sum += grade[i];
}
cgpa = sum / n;
return cgpa;
}
// Driver code
int main()
{
int n = 5;
double marks[] = { 90, 80, 70, 80, 90 };
double cgpa = CgpaCalc(marks, n);
cout << "CGPA = ";
printf("%.1f\n", cgpa);
cout << "CGPA Percentage = ";
printf("%.2f", cgpa * 9.5);
return 0;
}
0
Ok share your attempt
0
i unable to solve this problem
0
Try again and again...this is an easy one .... You can do it ..
0
double CgpaCalc(double marks[], int n)
{
// Variable to store the grades in
// every subject
double grade[n];
// Variables to store CGPA and the
// sum of all the grades
double cgpa, sum = 0;
// Computing the grades
for(int i = 0; i < n; i++)
{
grade[i] = (marks[i] / 10);
}
// Computing the sum of grades
for(int i = 0; i < n; i++)
{
sum += grade[i];
}
// Computing the CGPA
cgpa = sum / n;
return cgpa;
}
// Driver code
int main()
{
int n = 5;
double marks[] = { 90, 80, 70, 80, 90 };
double cgpa = CgpaCalc(marks, n);
cout << "CGPA = ";
printf("%.1f\n", cgpa);
cout << "CGPA Percentage = ";
printf("%.2f", cgpa * 9.5);
}
but it is showing wrong