Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,444 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,299 people online right now. Registration is fast and FREE... Join Now!




program help

 
Closed TopicStart new topic

program help

grimmben
3 Dec, 2007 - 10:17 PM
Post #1

New D.I.C Head
*

Joined: 25 Nov, 2007
Posts: 27


My Contributions
CODE
//Ch7AppE07.cpp – displays the product of the odd integers from 1 through 13
//Created/revised by <your name> on <current date>

#include <iostream>

using std::cout;
using std::endl;

int main()
{
    int product = 1;

        for (int count = 13; count >= 1; count = count - 1) {
        cout << count << endl;

    cout << "The product of the odd integers from 1 through 13 is " << product << endl;

    return 0;
}   //end of main function

User is offlineProfile CardPM
+Quote Post

MorphiusFaydal
RE: Program Help
3 Dec, 2007 - 10:35 PM
Post #2

D.I.C Lover
Group Icon

Joined: 12 May, 2005
Posts: 1,105



Thanked: 8 times
Expert In: Hardware, Networking

My Contributions
What's the question here?
User is online!Profile CardPM
+Quote Post

harshakirans
RE: Program Help
3 Dec, 2007 - 11:05 PM
Post #3

D.I.C Head
Group Icon

Joined: 26 Apr, 2006
Posts: 115



Thanked: 1 times
Dream Kudos: 150
My Contributions
From the code you have written it seems you are expecting product of numbers from 1 to 13.

To achieve this change your code as below.

CODE

#include <iostream>

using std::cout;
using std::endl;

int main()
{
    int product = 1;

        for (int count = 13; count >= 1; count = count - 1) {
        product*=count;
             }
cout << count << endl;

    cout << "The product of the odd integers from 1 through 13 is " << product << endl;

    return 0;
}   //end of main function


User is offlineProfile CardPM
+Quote Post

Closed TopicStart new topic
Time is now: 12/2/08 02:16PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month