Given that two int variables, total and amount , have
been declared, write a sequence of statements that:
initializes total to 0
reads three values into amount , one at a time.
After each value is read in to amount , it is added to the
value in total (that is, total is incremented by the value
in amount ).
Instructor's notes: If you use a loop, it must be a for loop.
And if you use a loop control variable for counting, you
must declare it.
Answer / raj
total= 0;
scanf("%d",&amount);
total +=amount;
scanf("%d",&amount);
total +=amount;
scanf("%d",&amount);
total +=amount;
Is This Answer Correct ? | 29 Yes | 16 No |
Assume that the int variables i and j have been declared, and that n has been declared and initialized. Write code that causes a "triangle" of asterisks of size n to be output to the screen. Specifically, n lines should be printed out, the first consisting of a single asterisk, the second consisting of two asterisks, the third consistings of three, etc. The last line should consist of n asterisks. Thus, for example, if n has value 3, the output of your code should be * ** *** You should not output any space characters. Hint: Use a for loop nested inside another for loop.
How to upgrade LOOP environment, I just mean, how can i make loop statement editable ? I just try some program using loop statement and checking it in multiple compilers. Every compiler showing different output, what's the wrong ? is it a compiler based problem, or loop based problem, tell me why ? and what will be the debugging process, for this kind of problem ?
How to create a program that lists countries capitals when country is entered? (Terribly sorry, I'm a complete novist to coding with C, am looking for inspiration and general tips on how to code and create this program.)
Write a c-programe that input one number of four digits and find digits sum?
what are the techniques for reducing the fragility of a memory bug?
Why are memory errors hard to debug?
Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;
Write a C program to enter 10 integer numbers through one variable and count how many of them are even using while loop ?
What is the code for following o/p * * * * * * * * * * * * * * * *
what is syntax error?
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;
wap for bubble sort