SlideShare une entreprise Scribd logo
1  sur  17
PRINTF(), SCANF()
CONVERSION SPECIFIERS
ESCAPE SEQUENCES
Input Output Management
Compiled By: Kamal Acharya
INPUT and OUTPUT
Compiled By: Kamal Acharya
 printf() will print formatted output to the screen.
 To print a message:
printf("This is a messagen");
 How do we print the value of a variable?
 Answer: Use special format specifiers depending on the type of
the variable
this is a string literal
Printing Output: printf()
Compiled By: Kamal Acharya
Compiled By: Kamal Acharya
int degreesF = 68;
printf("The temperature is %d degrees.", degreesF);
Specifier for
“print an integer value”
“and the value of
that number is read
from this variable”
> The temperature is 68 degrees.
Output:
Compiled By: Kamal Acharya
int a = 1;
int b = 2;
int c = 3;
printf(“%d plus %d is equal to %d", a, b, c);
1 plus 2 is equal to 3
Output:
Compiled By: Kamal Acharya
 Format specifiers:
 %c for single characters
 %d for integers
 %f for float/double (fractions): 1234.56
 %g for float/double (scientific): 1.23456E+3
 %s for phrases or ‘strings’
Compiled By: Kamal Acharya
Output:
A 65 41 101
Example:
char a='A';
printf("%c %d %x %0", a, a, a, a);
Compiled By: Kamal Acharya
Format specifier can be used with modifiers
Example :
%-6d, %5d, %6.2f
Modifier
digit
Description
Allocate minimum width (in characters).
.digit Number of floating-points
- left justified
l Print the data as a long integer.
Compiled By: Kamal Acharya
Statement Output
printf("|%d|", 987); |987|
printf("|%2d|", 987); |987|
printf("|%8d|", 987); | 987|
printf("|%-8d|", 987); |987 |
printf("|%0.2f|", 9876.54); |9876.54|
printf("|%4.2f|", 9876.54); |9876.54|
printf("|%3.1f|", 9876.54); |9876.5|
printf("|%10.3f|", 9876.54); | 9876.540|
Compiled By: Kamal Acharya
printf(“Hello n World!");
Hello
World!
Output:
‘n’ is not a data to be printed. Instead, it is a command that tells the
monitor to move the cursor to the next line
Compiled By: Kamal Acharya
Control Characters (Escape Sequences)
Character
'n'
't'
'v'
'r'
'x41'
'101'
'0'
'''
'"'
''
'b'
'f'
'a'
Description
newline
horizontal tab
vertical tab
carriage return
hexadecimal number, 0x41
octal number 101
null character - indicates the end of a string
single quatation mark (')
double quatation mark (")
backslash mark ()
backspace
formfeed - next page (used for printer)
alert - produce a beep sound
Compiled By: Kamal Acharya
Figure: Output specification for inventory report
printf (“Part NumbertQty On HandtQty On OrderttPricen”);
t t tt n
Compiled By: Kamal Acharya
Keyboard input: scanf()
 scanf() will scan formatted input from the keyboard.
 It uses the same format specifiers as printf()
 To read an integer:
 int num_students;
scanf("%d", &num_students);
Specifier for
“reading an integer value”
VERY IMPORTANT
special symbol
“Place value into this
variable”
Compiled By: Kamal Acharya
Compiled By: Kamal Acharya
Format specifiers for scanf()
 Format specifiers:
 %c for single characters
 scanf(" %c", &some_character);
 %d for integers
 scanf ("%d", &some_integer);
 %f for float
 scanf ("%f", &some_float);
 %lf for double
 scanf ("%lf", &some_double);
always put a space between " and % when reading characters
Compiled By: Kamal Acharya
Escape Sequences
Compiled By: Kamal Acharya

Contenu connexe

Tendances

Data Input and Output
Data Input and OutputData Input and Output
Data Input and OutputSabik T S
 
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdfMANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 
Chapter 6 Balagurusamy Programming ANSI in c
Chapter 6  Balagurusamy Programming ANSI  in cChapter 6  Balagurusamy Programming ANSI  in c
Chapter 6 Balagurusamy Programming ANSI in cBUBT
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial javaTpoint s
 
Handling of character strings C programming
Handling of character strings C programmingHandling of character strings C programming
Handling of character strings C programmingAppili Vamsi Krishna
 
Scope rules : local and global variables
Scope rules : local and global variablesScope rules : local and global variables
Scope rules : local and global variablessangrampatil81
 
Arrays in c unit iii chapter 1 mrs.sowmya jyothi
Arrays in c unit iii chapter 1 mrs.sowmya jyothiArrays in c unit iii chapter 1 mrs.sowmya jyothi
Arrays in c unit iii chapter 1 mrs.sowmya jyothiSowmya Jyothi
 
Chapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CChapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CBUBT
 
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C LanguageAdnan Khan
 
Memory allocation in c
Memory allocation in cMemory allocation in c
Memory allocation in cPrabhu Govind
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in CHarendra Singh
 
C programs
C programsC programs
C programsMinu S
 

Tendances (20)

Data Input and Output
Data Input and OutputData Input and Output
Data Input and Output
 
Strings
StringsStrings
Strings
 
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdfMANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
 
Input And Output
 Input And Output Input And Output
Input And Output
 
CPU INPUT OUTPUT
CPU INPUT OUTPUT CPU INPUT OUTPUT
CPU INPUT OUTPUT
 
Chapter 6 Balagurusamy Programming ANSI in c
Chapter 6  Balagurusamy Programming ANSI  in cChapter 6  Balagurusamy Programming ANSI  in c
Chapter 6 Balagurusamy Programming ANSI in c
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
Handling of character strings C programming
Handling of character strings C programmingHandling of character strings C programming
Handling of character strings C programming
 
Scope rules : local and global variables
Scope rules : local and global variablesScope rules : local and global variables
Scope rules : local and global variables
 
Function in c
Function in cFunction in c
Function in c
 
C# basics
 C# basics C# basics
C# basics
 
Arrays in c unit iii chapter 1 mrs.sowmya jyothi
Arrays in c unit iii chapter 1 mrs.sowmya jyothiArrays in c unit iii chapter 1 mrs.sowmya jyothi
Arrays in c unit iii chapter 1 mrs.sowmya jyothi
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Chapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CChapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in C
 
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C Language
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Memory allocation in c
Memory allocation in cMemory allocation in c
Memory allocation in c
 
C++ string
C++ stringC++ string
C++ string
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in C
 
C programs
C programsC programs
C programs
 

En vedette

Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’eShikshak
 
Input and output in c
Input and output in cInput and output in c
Input and output in cRachana Joshi
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...yazad dumasia
 
File handling-dutt
File handling-duttFile handling-dutt
File handling-duttAnil Dutt
 
C chap02
C chap02C chap02
C chap02Kamran
 
Module 03 File Handling in C
Module 03 File Handling in CModule 03 File Handling in C
Module 03 File Handling in CTushar B Kute
 
Formatted input and output
Formatted input and outputFormatted input and output
Formatted input and outputOnline
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_outputAnil Dutt
 
File handling in 'C'
File handling in 'C'File handling in 'C'
File handling in 'C'Gaurav Garg
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output OrganizationKamal Acharya
 

En vedette (20)

Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
 
Input and output in c
Input and output in cInput and output in c
Input and output in c
 
Managing console
Managing consoleManaging console
Managing console
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
 
File handling-dutt
File handling-duttFile handling-dutt
File handling-dutt
 
C chap02
C chap02C chap02
C chap02
 
Module 03 File Handling in C
Module 03 File Handling in CModule 03 File Handling in C
Module 03 File Handling in C
 
[UX Project] C-Saw
[UX Project] C-Saw[UX Project] C-Saw
[UX Project] C-Saw
 
Formatted input and output
Formatted input and outputFormatted input and output
Formatted input and output
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_output
 
Ponters
PontersPonters
Ponters
 
IO Management
IO ManagementIO Management
IO Management
 
File handling in C
File handling in CFile handling in C
File handling in C
 
File handling in 'C'
File handling in 'C'File handling in 'C'
File handling in 'C'
 
Pointers
PointersPointers
Pointers
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
C pointer
C pointerC pointer
C pointer
 
Slide share
Slide shareSlide share
Slide share
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output Organization
 

Similaire à Input Output Management In C Programming

Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’eShikshak
 
Unit 5 Foc
Unit 5 FocUnit 5 Foc
Unit 5 FocJAYA
 
Cse115 lecture04introtoc programming
Cse115 lecture04introtoc programmingCse115 lecture04introtoc programming
Cse115 lecture04introtoc programmingMd. Ashikur Rahman
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]Abhishek Sinha
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Functionimtiazalijoono
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02Wingston
 
Managing input and output operations in c
Managing input and output operations in cManaging input and output operations in c
Managing input and output operations in cniyamathShariff
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo cHanielle Cheng
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo cHanielle Cheng
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo cHanielle Cheng
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo cHanielle Cheng
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo cHanielle Cheng
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo cHanielle Cheng
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo cHanielle Cheng
 

Similaire à Input Output Management In C Programming (20)

input
inputinput
input
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
 
Unit 5 Foc
Unit 5 FocUnit 5 Foc
Unit 5 Foc
 
Cse115 lecture04introtoc programming
Cse115 lecture04introtoc programmingCse115 lecture04introtoc programming
Cse115 lecture04introtoc programming
 
Introduction to Input/Output Functions in C
Introduction to Input/Output Functions in CIntroduction to Input/Output Functions in C
Introduction to Input/Output Functions in C
 
week-3x
week-3xweek-3x
week-3x
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]
 
Najmul
Najmul  Najmul
Najmul
 
C programs
C programsC programs
C programs
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Function
 
C-programs
C-programsC-programs
C-programs
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
 
Managing input and output operations in c
Managing input and output operations in cManaging input and output operations in c
Managing input and output operations in c
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo c
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo c
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo c
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo c
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo c
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo c
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo c
 

Plus de Kamal Acharya

Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computerKamal Acharya
 
Introduction to Computer Security
Introduction to Computer SecurityIntroduction to Computer Security
Introduction to Computer SecurityKamal Acharya
 
Making decision and repeating in PHP
Making decision and repeating  in PHPMaking decision and repeating  in PHP
Making decision and repeating in PHPKamal Acharya
 
Working with arrays in php
Working with arrays in phpWorking with arrays in php
Working with arrays in phpKamal Acharya
 
Text and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPText and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPKamal Acharya
 
Capacity Planning of Data Warehousing
Capacity Planning of Data WarehousingCapacity Planning of Data Warehousing
Capacity Planning of Data WarehousingKamal Acharya
 
Information Privacy and Data Mining
Information Privacy and Data MiningInformation Privacy and Data Mining
Information Privacy and Data MiningKamal Acharya
 
Association Analysis in Data Mining
Association Analysis in Data MiningAssociation Analysis in Data Mining
Association Analysis in Data MiningKamal Acharya
 
Classification techniques in data mining
Classification techniques in data miningClassification techniques in data mining
Classification techniques in data miningKamal Acharya
 
Introduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data WarehousingIntroduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data WarehousingKamal Acharya
 

Plus de Kamal Acharya (20)

Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
 
Computer Arithmetic
Computer ArithmeticComputer Arithmetic
Computer Arithmetic
 
Introduction to Computer Security
Introduction to Computer SecurityIntroduction to Computer Security
Introduction to Computer Security
 
Session and Cookies
Session and CookiesSession and Cookies
Session and Cookies
 
Functions in php
Functions in phpFunctions in php
Functions in php
 
Web forms in php
Web forms in phpWeb forms in php
Web forms in php
 
Making decision and repeating in PHP
Making decision and repeating  in PHPMaking decision and repeating  in PHP
Making decision and repeating in PHP
 
Working with arrays in php
Working with arrays in phpWorking with arrays in php
Working with arrays in php
 
Text and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPText and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHP
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Capacity Planning of Data Warehousing
Capacity Planning of Data WarehousingCapacity Planning of Data Warehousing
Capacity Planning of Data Warehousing
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousing
 
Search Engines
Search EnginesSearch Engines
Search Engines
 
Web Mining
Web MiningWeb Mining
Web Mining
 
Information Privacy and Data Mining
Information Privacy and Data MiningInformation Privacy and Data Mining
Information Privacy and Data Mining
 
Cluster Analysis
Cluster AnalysisCluster Analysis
Cluster Analysis
 
Association Analysis in Data Mining
Association Analysis in Data MiningAssociation Analysis in Data Mining
Association Analysis in Data Mining
 
Classification techniques in data mining
Classification techniques in data miningClassification techniques in data mining
Classification techniques in data mining
 
Data Preprocessing
Data PreprocessingData Preprocessing
Data Preprocessing
 
Introduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data WarehousingIntroduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data Warehousing
 

Dernier

Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 

Dernier (20)

Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 

Input Output Management In C Programming

  • 1. PRINTF(), SCANF() CONVERSION SPECIFIERS ESCAPE SEQUENCES Input Output Management Compiled By: Kamal Acharya
  • 2. INPUT and OUTPUT Compiled By: Kamal Acharya
  • 3.  printf() will print formatted output to the screen.  To print a message: printf("This is a messagen");  How do we print the value of a variable?  Answer: Use special format specifiers depending on the type of the variable this is a string literal Printing Output: printf() Compiled By: Kamal Acharya
  • 5. int degreesF = 68; printf("The temperature is %d degrees.", degreesF); Specifier for “print an integer value” “and the value of that number is read from this variable” > The temperature is 68 degrees. Output: Compiled By: Kamal Acharya
  • 6. int a = 1; int b = 2; int c = 3; printf(“%d plus %d is equal to %d", a, b, c); 1 plus 2 is equal to 3 Output: Compiled By: Kamal Acharya
  • 7.  Format specifiers:  %c for single characters  %d for integers  %f for float/double (fractions): 1234.56  %g for float/double (scientific): 1.23456E+3  %s for phrases or ‘strings’ Compiled By: Kamal Acharya
  • 8. Output: A 65 41 101 Example: char a='A'; printf("%c %d %x %0", a, a, a, a); Compiled By: Kamal Acharya
  • 9. Format specifier can be used with modifiers Example : %-6d, %5d, %6.2f Modifier digit Description Allocate minimum width (in characters). .digit Number of floating-points - left justified l Print the data as a long integer. Compiled By: Kamal Acharya
  • 10. Statement Output printf("|%d|", 987); |987| printf("|%2d|", 987); |987| printf("|%8d|", 987); | 987| printf("|%-8d|", 987); |987 | printf("|%0.2f|", 9876.54); |9876.54| printf("|%4.2f|", 9876.54); |9876.54| printf("|%3.1f|", 9876.54); |9876.5| printf("|%10.3f|", 9876.54); | 9876.540| Compiled By: Kamal Acharya
  • 11. printf(“Hello n World!"); Hello World! Output: ‘n’ is not a data to be printed. Instead, it is a command that tells the monitor to move the cursor to the next line Compiled By: Kamal Acharya
  • 12. Control Characters (Escape Sequences) Character 'n' 't' 'v' 'r' 'x41' '101' '0' ''' '"' '' 'b' 'f' 'a' Description newline horizontal tab vertical tab carriage return hexadecimal number, 0x41 octal number 101 null character - indicates the end of a string single quatation mark (') double quatation mark (") backslash mark () backspace formfeed - next page (used for printer) alert - produce a beep sound Compiled By: Kamal Acharya
  • 13. Figure: Output specification for inventory report printf (“Part NumbertQty On HandtQty On OrderttPricen”); t t tt n Compiled By: Kamal Acharya
  • 14. Keyboard input: scanf()  scanf() will scan formatted input from the keyboard.  It uses the same format specifiers as printf()  To read an integer:  int num_students; scanf("%d", &num_students); Specifier for “reading an integer value” VERY IMPORTANT special symbol “Place value into this variable” Compiled By: Kamal Acharya
  • 16. Format specifiers for scanf()  Format specifiers:  %c for single characters  scanf(" %c", &some_character);  %d for integers  scanf ("%d", &some_integer);  %f for float  scanf ("%f", &some_float);  %lf for double  scanf ("%lf", &some_double); always put a space between " and % when reading characters Compiled By: Kamal Acharya