CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2009
    Posts
    15

    Need help with this coding plzz

    Write a C program which takes number of integers to sum and gives following output:
    Enter the number of integers you want to sum: 5
    1 = 1
    1+2 = 3
    1+2+3 = 6
    1+2+3+4 = 10
    1+2+3+4+5 = 15

    remember v can use only iostream and the loops v can use are for loops,while and do while loops...
    for condition if else can also b used...thank u

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Need help with this coding plzz

    Victor Nijegorodov

  3. #3
    Join Date
    Oct 2009
    Posts
    15

    Re: Need help with this coding plzz

    i am sorry ... but i have done some of the program but am confused on a part ?? can i ask about that part???

  4. #4
    Join Date
    Jun 2008
    Posts
    592

    Re: Need help with this coding plzz

    You can ask what you're stuck on, but posting your code as well will get you help faster

    Also use the code tag
    Code:
    code here
    0100 0111 0110 1111 0110 0100 0010 0000 0110 1001 0111 0011 0010 0000 0110 0110 0110 1111 0111 0010
    0110 0101 0111 0110 0110 0101 0111 0010 0010 0001 0010 0001 0000 0000 0000 0000
    0000 0000 0000 0000

  5. #5
    Join Date
    Oct 2009
    Posts
    15

    Re: Need help with this coding plzz

    actually i was helping my younger brother... and i came up with this code but he says he hasnt used system and namespace in his studies yet....

    #include <iostream>
    using namespace std;

    int main()
    {
    int input, output = 0;
    cout << "Enter an integer: ";
    cin >> input;

    for( int i = input; i > 0; i-- )
    output += i;

    cout << output;

    system("PAUSE");
    return 0;
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured