Answer to Question #12965 in C++ for Gary

Question #12965
Hi!! How can i count the total marks for my user,which they are after answering almost 20 questions?
is it any C++ coding can help me to count the marks?
1
Expert's answer
2012-08-14T10:07:30-0400
Here is an example of C++ program that asks for 20 numbers and counts their sum:

#include <iostream.h>

bool even(int i){
if (i%2==0) return true;
else return false;
}

int s=0, a;
int i;

void main(){
for (i=1;i<21;i++){
& cout<<"enter mark "<<i<<": ";
& cin>>a;
& s+=a;
}
cout<<"\nSum of entered numbers is "<<s<<"\n";
}

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
APPROVED BY CLIENTS