- 2
Write a program that displays an integer then increments the integer by 3.
4 Answers
+ 3
#include <stdio.h>
int main(){
int c;
printf("Enter value of c: \n");
scanf("%d", &c);
c += 3;
printf("%d", c);
return 0;
}
+ 3
Your code is working fine but if you have to give the output in a test case then you have to follow the question of how do they want to print the output.
For example:
Sample input:
3
Sample output:
6
then if you print the line Enter value of c: it won't work because the machine doesn't understand english.
+ 2
Seems to be your homework anyways post what you have tried
0
If I only wrote the scanf bit without the printf bit above it and someone else tried to run it, they wouldn't know when to enter the value of c so, yeah...