Write a single C statement to accomplish each of the following: a) Define the va
ID: 3714789 • Letter: W
Question
Write a single C statement to accomplish each of the following:
a) Define the variables c, thisVariable, q76354 and number to be of type int.
b) Prompt the user to enter an integer. End your prompting message with a colon ( followed by a space and leave the cursor positioned after the space.
c) Read an integer from the keyboard and store the value entered in integer variable a.
e) Print the message " This is a C program." on one line.
f) Print the message " This is a C program." on two lines so that the first line ends with C.
g) Print the message " This is a C program." with each word on a separate line.
h) Print the message " This is a C program." with the words separated by tabs.
2.7 a, b, f, j ,
Identify and correct the errors in each of the following statements. ( Note: There may be more than one error per statement.)
a) scanf( " d", value );
b) printf( " The product of % d and % d is % d" n, x, y );
f) Scanf( "% d", anInteger );
j) Printf( " The value you entered is: % d n, & value )
Explanation / Answer
Answer:
int thisVariable,q76354 ;
printf("Enter an integer: ");
scanf("%d", &a);
printf("This is a C program");
printf("This is a C program");
printf("This is a C program ");
printf("This is a C program");
a) scanf( " d", value );
Answer: scanf( "%d", &value );
b) printf( " The product of % d and % d is % d" n, x, y );
Answer: printf( " The product of % d and % d is % d ", x, y,x*y );
f) Scanf( "% d", anInteger );
Answer:
scanf( "%d", &anInteger );
j) Printf( " The value you entered is: % d n, & value )
Answer:
printf( "The value you entered is: % d ", value );
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.