SlideShare a Scribd company logo
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
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;
}

More Related Content

PPTX
Write a program that accepts percentage from the user and displays its grade ...
PPTX
C programming
PPTX
function in c
PPTX
Global variables, sorting static variables,function and arrays,
PPTX
Introduction to C programming
DOC
print even or odd number in c
PPTX
Input output statement in C
PPTX
Data Input and Output
Write a program that accepts percentage from the user and displays its grade ...
C programming
function in c
Global variables, sorting static variables,function and arrays,
Introduction to C programming
print even or odd number in c
Input output statement in C
Data Input and Output

What's hot (20)

PPTX
Intro to c chapter cover 1 4
DOCX
Practical no 6
PPTX
C Programming Language Part 7
PPTX
3. user input and some basic problem
PPT
Relational operators In C language (By: Shujaat Abbas)
PDF
First c program
PPTX
2.1 input and output in c
DOCX
C programming Lab 1
PPTX
1.2 programming fundamentals
PPTX
2. introduction of a c program
PDF
Bcsl 033 data and file structures lab s3-2
PDF
201801 CSE240 Lecture 06
PPTX
C Programming Language Step by Step Part 2
DOCX
Programming fundamentals
PDF
7. input and output functions
PPTX
How c program execute in c program
PPTX
Working with IDE
DOCX
Muzzammilrashid
PPTX
C Programming Language Part 9
Intro to c chapter cover 1 4
Practical no 6
C Programming Language Part 7
3. user input and some basic problem
Relational operators In C language (By: Shujaat Abbas)
First c program
2.1 input and output in c
C programming Lab 1
1.2 programming fundamentals
2. introduction of a c program
Bcsl 033 data and file structures lab s3-2
201801 CSE240 Lecture 06
C Programming Language Step by Step Part 2
Programming fundamentals
7. input and output functions
How c program execute in c program
Working with IDE
Muzzammilrashid
C Programming Language Part 9
Ad

Similar to C taking user input (20)

PPT
Fundamental of C Programming Language and Basic Input/Output Function
PPTX
Input and Output In C Language
PPSX
C basics 4 std11(GujBoard)
PPT
Chapter3
PPTX
Basic of C Programming | 2022 Updated | By Shamsul H. Ansari
PPTX
1_Introduction of programming language C.pptx
PPT
CPU INPUT OUTPUT
PPTX
Sample for Simple C Program - R.D.Sivakumar
PPTX
Unit 2 CMath behind coding.pptx
PPSX
Concepts of C [Module 2]
DOCX
UNIT-II CP DOC.docx
PPTX
Programming Fundamentals lecture 5
PDF
Introduction to programming c and data-structures
PDF
CP Handout#2
PPT
Introduction to C Programming
PPT
Unit 4 Foc
DOCX
Programming in c
PPTX
C Language ppt create by Anand & Sager.pptx
PDF
Introduction to programming c and data structures
PDF
Module 1_Chapter 2_PPT (1)sasaddsdsds.pdf
Fundamental of C Programming Language and Basic Input/Output Function
Input and Output In C Language
C basics 4 std11(GujBoard)
Chapter3
Basic of C Programming | 2022 Updated | By Shamsul H. Ansari
1_Introduction of programming language C.pptx
CPU INPUT OUTPUT
Sample for Simple C Program - R.D.Sivakumar
Unit 2 CMath behind coding.pptx
Concepts of C [Module 2]
UNIT-II CP DOC.docx
Programming Fundamentals lecture 5
Introduction to programming c and data-structures
CP Handout#2
Introduction to C Programming
Unit 4 Foc
Programming in c
C Language ppt create by Anand & Sager.pptx
Introduction to programming c and data structures
Module 1_Chapter 2_PPT (1)sasaddsdsds.pdf
Ad

More from ArghodeepPaul (12)

PDF
Microprocessor questions converted
PDF
Windows script host
PDF
Windows batch scripting
PDF
Common problems solving using c
PDF
C operators
PDF
C storage classes
PDF
C datatypes
PDF
C variables and constants
PDF
C program structure
PDF
Computer programming tools and building process
PDF
Algorithm pseudocode flowchart program notes
PDF
notes on Programming fundamentals
Microprocessor questions converted
Windows script host
Windows batch scripting
Common problems solving using c
C operators
C storage classes
C datatypes
C variables and constants
C program structure
Computer programming tools and building process
Algorithm pseudocode flowchart program notes
notes on Programming fundamentals

Recently uploaded (20)

PDF
Digital Logic Computer Design lecture notes
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
additive manufacturing of ss316l using mig welding
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Welding lecture in detail for understanding
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPT
Mechanical Engineering MATERIALS Selection
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Construction Project Organization Group 2.pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPT
Project quality management in manufacturing
PDF
Well-logging-methods_new................
PPTX
Lecture Notes Electrical Wiring System Components
Digital Logic Computer Design lecture notes
CH1 Production IntroductoryConcepts.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
additive manufacturing of ss316l using mig welding
R24 SURVEYING LAB MANUAL for civil enggi
Welding lecture in detail for understanding
Embodied AI: Ushering in the Next Era of Intelligent Systems
Mechanical Engineering MATERIALS Selection
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Construction Project Organization Group 2.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Project quality management in manufacturing
Well-logging-methods_new................
Lecture Notes Electrical Wiring System Components

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; }