Using while loops to add odd integers

Microsoft Visual studio 2008 professiona...
February 17, 2010 at 19:54:56
Specs: Windows Vista
I need to write a program for class using the while loop so that the prompt says "How many odd integers do you want to add" you enter the number for example, 4, and than it adds the first 4 odd integers and prompts out the total. PLEASE HELP ME.

See More: Using while loops to add odd integers

Report •

February 17, 2010 at 23:54:55
All you'll need to do is start your iterator at 1, increment the iterator by 2, and multiply the user's number of ints by 2...

declare and initialize vars
show your prompt
get your input

while(start <= user_num_ints * 2) {
// sum start
// increment start by 2

output the sum

just for grins, enter an alpha character for the input. :P


Report •

March 3, 2010 at 13:06:32
hi sami, the code of ur problem is as follows
int n,s,e;
cout<<"please enter the first number";
cout<<"please enter the ending number";

hope u will got it

Report •

March 23, 2010 at 17:33:40
I have to create a while loop to prompt user for 3 numbers without using thr -a(and) -o(or) else, or elif. I can use 2 if statements. ANyone know how to do this???

Report •

Related Solutions

April 24, 2010 at 13:01:02
i actually did the same thing using a do while statement and a for statement but idnt understand how to make it print the answer only once.

Report •

Ask Question