Given that two int variables, total and amount, have been
declared, write a loop that reads integers into amount and
adds all the non-negative values into total. The loop
terminates when a value less than 0 is read into amount.
Don't forget to initialize total to 0.
Instructor's notes: This problem requires either a while or
a do-while loop.
Answers were Sorted based on User's Feedback
Answer / helen
total=0;
cin>>amount;
while (amount>=0)
{
total=total+amount;
cin>>amount;
}
| Is This Answer Correct ? | 43 Yes | 20 No |
Answer / cammy pope
total=0;
cin>>amount;
total= total+amount;
cin>>amount;
total= total+amount;
cin>>amount;
total= total+amount;
| Is This Answer Correct ? | 10 Yes | 13 No |
Answer / abhishek rajput
int total=0, amount;
scanf("%d",&amount);
while(amount>0)
{
total=total+amount;
scanf("%d",&amount);
}
printf("total=%d",total);
| Is This Answer Correct ? | 1 Yes | 5 No |
Write a C program to enter 10 integer numbers through one variable and count how many of them are even using while loop ?
how tally is useful?
Write down the difference between c. Loop and goto statement d. (!0) and (!1) e. (1= =! 1) and (1!=1) f. NULL and !NULL
I'm having trouble with coming up with the correct code. Thank You!! The assignment was to write a program using string functions that accepts a price of an item and displays its coded value. The base of the keys: X C O M P U T E R S 0 1 2 3 4 5 6 7 8 9 Sample I/O Dialogue: Enter Price: 489.50 Coded Value: PRS.UX
how to convert decimal to binary in c using while loop without using array
50 Answers Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,
which typw of errors ? & how to solve it ?
when i use cout or cin call & then either << or >> .....it shows declaration syntax error...what should i do? cout<<"anything"; int a; cin>>a; return 0;
Write a c-programe that input one number of four digits and find digits sum?
What is probability to guarantee that the task a programmer is going to create will be created and be able to run on a particular system (RTOS/GPOS).
Given that two int variables, total and amount, have been declared, write a loop that reads integers into amount and adds all the non-negative values into total. The loop terminates when a value less than 0 is read into amount. Don't forget to initialize total to 0. Instructor's notes: This problem requires either a while or a do-while loop.
What is the code for following o/p * * * * * * * * * * * * * * * *
I am using Qt 5.6 during compilation it stops and gives error about Qmake The process "C:QtQt5.6.35.6.3msvc2015_64inqmake.exe" crashed. Error while building/deploying project untitled1 (kit: Desktop Qt 5.6.3 MSVC2015 64bit) When executing step "qmake"