c input is skipped
#include <stdio.h>
int main() {
int num;
printf("Enter a number: ");
scanf("%d", &num);
printf("The entered number is: %d\n", num);
return 0;
}
Explanation:
- #include <stdio.h>
: Includes the standard input-output header file for input/output operations.
- int main() { ... }
: Declares the main function where the program execution begins.
- int num;
: Declares an integer variable named num
to store the user input.
- printf("Enter a number: ");
: Displays a message prompting the user to enter a number.
- scanf("%d", &num);
: Reads an integer from the user input and stores it in the variable num
.
- printf("The entered number is: %d\n", num);
: Displays the entered number using the %d
format specifier.
- return 0;
: Indicates successful completion of the program.