Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

pls help me..write a C++ function to sum n natural numbers pls help me..write a C++ function to sum n natural numbers @Computer Science

OpenStudy (alfie):

#include <iostream> using namespace std; int main() { int number; int result = 0; do { cout << "Enter a number (0 to terminate)" << endl; cin >> number; result = result + number; cout << "Current result is " << result << endl; }while(number != 0); system("PAUSE"); }

OpenStudy (anonymous):

thank u... :) wt is system("PAUSE");

OpenStudy (alfie):

It's used so that the console doesn't close after reading all of the instructions.

OpenStudy (anonymous):

okie...tnx again...

OpenStudy (alfie):

You're welcome :)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!