1.
What is the correct way to have the user input an integer and store it in the variable age?
Feel free to use the window below to try out some commands.
Compile and run the code below in your own C environment.
#include <stdio.h>
int main(void)
{
int age;
age = 0;
printf("Please enter your age: ");
/* Your code here. */
/* And here some code to test whether everything worked correctly - don't change this! */
printf("You entered that the age is %d.", age);
return(0);
}
-
scanf("%d", &age); -
Correct
-
scanf("%d", age); -
Not quite. Try again!
-
scanf("%age", &d); -
Not quite. Try again!
-
scanf("&age"); -
Not quite. Try again!

