Thread: is the program related to the question?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Registered User
    Join Date
    Apr 2015
    Posts
    15
    Quote Originally Posted by vart View Post
    No, running sum mean you need to continue add numbers til 0 is entered
    Output should be something like this
    Code:
    Enter Number: 10
    Running sum: 10, enter next number: 5
    Running sum: 15, enter next number: 1
    Running sum: 16, enter next number: 3
    Running sum: 18, enter next number: 0
    
    Final sum 18, thank you for using our product.
    is this ok?
    Code:
    #include<iostream>
    using namespace std;
    int main()
    {
    int num1,next_numbers,total;
    cout<<"enter the number:\n";
    cin>>num1;
    cout<<"\nenter next number:\n";
    cin>>next_numbers;
    total=num1+next_numbers;
    cout<<"sum is at:\n"<<total;
    for(next_numbers;next_numbers!=0;)
    {
    cout<<"\nenter next number:\n";
    cin>>next_numbers;
    total=total+next_numbers;
    cout<<"sum is at:\n"<<total;
    }
    }
    Last edited by recklezz; 04-16-2015 at 08:46 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with first c++ program (math-related)
    By necrovamp in forum C++ Programming
    Replies: 4
    Last Post: 09-23-2010, 12:33 PM
  2. A graphics related question
    By GOBLIN-85 in forum C++ Programming
    Replies: 7
    Last Post: 12-20-2008, 01:37 PM
  3. A question related to BGI
    By progue in forum Windows Programming
    Replies: 6
    Last Post: 05-25-2008, 10:04 AM
  4. Dos related Question
    By MethodMan in forum A Brief History of Cprogramming.com
    Replies: 31
    Last Post: 07-02-2002, 12:16 PM
  5. non program related questions about C
    By Nova in forum C Programming
    Replies: 3
    Last Post: 10-16-2001, 03:42 PM

Tags for this Thread