+ 3
How can write program to calculate average provided that the grades smaller or equal to 100
17 ответов
0
Will you write this program in c ++?
0
I need help me in this program
0
The only thing I don't know how to do, is to prepare for multiple inputs. But, you would add all the inputs, then divide them by the number of inputs.
0
I can help you tell the full story of the program
0
Let's say you have a set amount of tests. You have 10 tests and want to calculate the average.
Set ten different variables as inputs.
Then add all inputs then divide by ten.
0
let's say you have 7 grades
0
but how can do conditions of this problem
0
int I;
int a;
int m;
int e;
int p;
int b;
int c;
0
float average;
0
Sung,
Add all the variables together in a new int called "sum"
Now make float average = sum/7
0
how can make condition?
by use if or switch
0
if (int l, int e, so on so fourth > 100)
Print "Please enter a test grade lower than 100.";
Return;
Else
Print average
0
so
I say
sum=(i+a+m+e+p+b+c);
0
Yes then make average = sum/7
0
#include <iostream>
using namespace std;
int main() {
int fexam, sexam, texam, avg;
cout << "Enter the first exam grade: ";
cin >> fexam;
cout << "Enter the second exam grade: ";
cin >> sexam;
cout << "Enter the third exam grade: ";
cin >> texam;
avg= (fexam+sexam+texam)/3;
if (avg >=0 && avg<=45)
cout <<"You did not pass the class successfully";
else if (avg >=46 && avg<=69)
cout << "You need to work a little more";
else if (avg >=70 && avg<=84)
cout << "You can be a successful student with a little more effort.";
else if (avg >=85 && avg <=100)
cout << "Congratulations, you passed the class with success.";
return 0;
}
0
Maybe it might not work, but you can create something like this.
0
OK
thank you