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.
What is the out put of this programme? int a,b,c,d; printf("Enter Number!\n"); scanf("%d",&a); while(a=!0) { printf("Enter numbers/n"); scanf("%d%d%d",&b,&c,&d); a=a*b*c*d; } printf("thanks!"); getche(); Entering numbers are a=1,b=2,c=3,d=4 b=3,c=4,d=-5 b=3,c=4,d=0
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.
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 develop a program using C language to convert 8-bit binary values to decimals. TQ
To generate the series 1+3+5+7+... using C program
Write down the difference between c. Loop and goto statement d. (!0) and (!1) e. (1= =! 1) and (1!=1) f. NULL and !NULL
what is run time error?
#include"stdio.h" #include"conio.h" void main() { int a; printf("\n enter a number:"); scanf("%c\n"); getch(); }
What is the code for following o/p * * * * * * * * * * * * * * * *
what is exceptions?
full c programming error question based problem