Write a C Program to accept User Input and Print the same as an output. The C language has a scanf statement that accepts the user inputs based on the string format. This program allows users to insert numeric values and print the same.
#include <stdio.h> int main() { int num; printf("Please enter any number = "); scanf("%d",&num); printf("The User Enetered Integer = %d", num); return 0; }
This C Program accepts the float and character user Input and prints them.
#include <stdio.h> int main() { float num; char ch; printf("\nPlease enter any Character = "); scanf("%c",&ch); printf("The User Enetered Charcater = %c\n", ch); printf("\nPlease enter any number = "); scanf("%f",&num); printf("The User Enetered Float Value = %.2f\n", num); return 0; }
Please enter any Character = G
The User Enetered Charcater = G
Please enter any number = 22.4
The User Enetered Float Value = 22.40