College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
C taking user input
1. Notes on
C User Input
Instructor:
Arghodeep Paul
Firmware Engineer at BitBible Technologies Pvt. Ltd.
Content Author: Arghodeep Paul
License: OpenSource
Date: 15 July 2021
2. User Input
Every Program should have some sort of User interaction, for example a value for a
variable.
The User will enter one or more values to store in Memory Locations. This is similar
to referencing the variable in the Memory and putting the Value in it.
Syntax
int n;
scanf(“%d”,&n);
scanf: is the Function responsible for taking user input.
%d: format specifier for taking the input value format
Examples
#include <stdio.h>
int main() {
int ascii; // declaration only
printf("Enter the ASCII decimal: ");
scanf("%d",&ascii);
printf("The Character is: %c",ascii);
return 0;
}
#include <stdio.h>
int main() {
float marks; // declaration only
printf("Enter the Marks in float: ");
scanf("%f",&marks);
printf("Obtained Marks: %0.2f",marks);
return 0;
}