+ 1
help me!! this question want using by while statement. help me pleaseeeeee. i need it tomorrow before 10 a.m
float marks,totMarks = 0, average; int cnt = 0 for (cin >> marks; marks >=0; cin >> marks) { totMarks = totMarks + marks; cnt++ cout << ":marks =" << marks << endl; } average = totMarks / cnt; cout << "average marks=" << average << endl;
8 Respuestas
+ 5
As I wrote it. Not sure if it can be done with other way...
+ 4
float marks,totMarks = 0, average;
int cnt = 0
while (marks >=0)
{
cin<<marks
totMarks += marks;
cnt++
cout << ":marks =" << marks << endl;
}
average = totMarks / cnt;
cout << "average marks=" << average << endl;
-----------------------------------------------------------
Not sure if functional tho~
+ 4
What do you want it to do?
+ 4
I already rewrote it with while, see comments above...
+ 2
im not sure. thats why i ask
+ 2
i want creat a program by using while statement based that program. can you help me?
+ 2
oh. okay. i forgot it.. thanks for helping :)
+ 2
if question want it by loop statement, how is it in program?