SlideShare ist ein Scribd-Unternehmen logo
1 von 14
DATA INPUT AND OUTPUT
INPUT/OUTPUT IN C
 C has no built-in statements for input or output.
 A library of functions is supplied to perform
these operations. The I/O library functions are
listed the “header” file <stdio.h>.
 You do not need to memorize them, just be
familiar with them.
STREAMS
 All input and output is performed with streams.
 A "stream" is a sequence of characters
organized into lines.
 Each line consists of zero or more characters
and ends with the "newline" character.
TYPES OF STREAMS IN C
 Standard input stream is called "stdin" and is
normally connected to the keyboard
 Standard output stream is called "stdout" and
is normally connected to the display screen.
 Standard error stream is called "stderr" and is
also normally connected to the screen
I/O FUNCTIONS IN C
 There are six i/o functions in C are:
 1. getchar()
 2. putchar()
 3. printf()
 4.scanf()
 5.gets()
 6.puts()
GETCHAR()
 getchar();
 Single character can be entered in computer
using C.
 Example:
 Char c;
 …………
 …….
 C=getchar();
PUTCHAR()
 putchar();
 It is used to display single char.
 Example
char c=‘H’;
putchar(c);
SCANF
scanf ( ) ;
 This function provides for formatted input from the
keyboard. The syntax is:
scanf ( “format” , &var1, &var2, …) ;
 The “format” is a listing of the data types of the
variables to be input and the & in front of each
variable name tells the system WHERE to store the
value that is input. It provides the address for the
variable.
 Example:
float a; int b;
scanf (“%f%d”, &a, &b
FORMAT OF DATA
 Format Conversion Specifiers:
d -- displays a decimal (base 10) integer
l -- used with other specifies to indicate a "long"
e -- displays a floating point value in exponential
notation
f -- displays a floating point value
g -- displays a number in either "e" or "f" format
c -- displays a single character
s -- displays a string of characters
STRINGS
 When you enter string data the compiler
automatically add 0 in the end of string;
 Char name[22];
 gets(name);
 ‘ROHIT’
 But actual value stored in computer is
‘ROHIT0’
PRINTF
 This function provides for formatted output to
the screen. The syntax is:
printf ( “format”, var1, var2, … ) ;
 The “format” includes a listing of the data types
of the variables to be output and, optionally,
some text and control character(s).
 Example:
float a ; int b ;
scanf ( “%f%d”, &a, &b ) ;
printf ( “You entered %f and %d n”, a, b ) ;
GETS AND PUTS
 To input a string to computer
 gets(name);
 Puts is used to display string data on screen
 puts(name);
ANY QUESTIONS
THANK YOU
With regards
slideshare.net/sabik.sabz

Weitere ähnliche Inhalte

Was ist angesagt?

Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)Ritika Sharma
 
structure and union
structure and unionstructure and union
structure and unionstudent
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptxSKUP1
 
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
 
Strings in c
Strings in cStrings in c
Strings in cvampugani
 
String in c programming
String in c programmingString in c programming
String in c programmingDevan Thakur
 
Operators in c language
Operators in c languageOperators in c language
Operators in c languageAmit Singh
 
Type casting in java
Type casting in javaType casting in java
Type casting in javaFarooq Baloch
 
Strings in C language
Strings in C languageStrings in C language
Strings in C languageP M Patil
 
C programming - String
C programming - StringC programming - String
C programming - StringAchyut Devkota
 

Was ist angesagt? (20)

Structure in C
Structure in CStructure in C
Structure in C
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
 
Strings IN C
Strings IN CStrings IN C
Strings IN C
 
structure and union
structure and unionstructure and union
structure and union
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
 
File handling in c
File handling in cFile handling in c
File handling in c
 
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
 
Strings in c
Strings in cStrings in c
Strings in c
 
String in c programming
String in c programmingString in c programming
String in c programming
 
Operators in c language
Operators in c languageOperators in c language
Operators in c language
 
Type casting in java
Type casting in javaType casting in java
Type casting in java
 
Pointers
PointersPointers
Pointers
 
Strings in C language
Strings in C languageStrings in C language
Strings in C language
 
C programming - String
C programming - StringC programming - String
C programming - String
 
Arrays and Strings
Arrays and Strings Arrays and Strings
Arrays and Strings
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
 
Structure in C language
Structure in C languageStructure in C language
Structure in C language
 
Strings
StringsStrings
Strings
 
Strings in C
Strings in CStrings in C
Strings in C
 

Andere mochten auch (17)

DATA PROCESSING
DATA PROCESSINGDATA PROCESSING
DATA PROCESSING
 
Presentation Skills For MARKETING Managers
Presentation Skills For MARKETING ManagersPresentation Skills For MARKETING Managers
Presentation Skills For MARKETING Managers
 
Marketing strategy ppt slides
Marketing strategy ppt slidesMarketing strategy ppt slides
Marketing strategy ppt slides
 
Customer Equity
Customer EquityCustomer Equity
Customer Equity
 
Marketing plan ppt slides
Marketing plan ppt slidesMarketing plan ppt slides
Marketing plan ppt slides
 
Strategy Execution
Strategy Execution Strategy Execution
Strategy Execution
 
Customer Service Strategy
Customer Service StrategyCustomer Service Strategy
Customer Service Strategy
 
Innovation Strategy
Innovation StrategyInnovation Strategy
Innovation Strategy
 
Creative Thinking Skills
Creative Thinking SkillsCreative Thinking Skills
Creative Thinking Skills
 
Blue ocean strategy ppt slides
Blue ocean strategy ppt slidesBlue ocean strategy ppt slides
Blue ocean strategy ppt slides
 
Marketing Management
Marketing ManagementMarketing Management
Marketing Management
 
Strategic Planning For Managers
Strategic Planning For Managers   Strategic Planning For Managers
Strategic Planning For Managers
 
52 Types of Marketing Strategies
52 Types of Marketing Strategies52 Types of Marketing Strategies
52 Types of Marketing Strategies
 
Brand Strategy
Brand StrategyBrand Strategy
Brand Strategy
 
New Product Development Strategy
New Product Development StrategyNew Product Development Strategy
New Product Development Strategy
 
Marketing Strategy
Marketing StrategyMarketing Strategy
Marketing Strategy
 
Managing Customer Service
Managing Customer Service  Managing Customer Service
Managing Customer Service
 

Ähnlich wie Data Input and Output

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
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]Abhishek Sinha
 
Programming Fundamentals lecture 5
Programming Fundamentals lecture 5Programming Fundamentals lecture 5
Programming Fundamentals lecture 5REHAN IJAZ
 
Chapter3
Chapter3Chapter3
Chapter3Kamran
 
Presention programming
Presention programmingPresention programming
Presention programmingsaleha iqbal
 
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
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)indrasir
 
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C LanguageAdnan Khan
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxAnkitaVerma776806
 
c_pro_introduction.pptx
c_pro_introduction.pptxc_pro_introduction.pptx
c_pro_introduction.pptxRohitRaj744272
 
Input and output basic of c++ programming and escape sequences
Input and output basic of c++ programming and escape sequencesInput and output basic of c++ programming and escape sequences
Input and output basic of c++ programming and escape sequencesssuserf86fba
 

Ähnlich wie Data Input and Output (20)

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
 
CHAPTER 4
CHAPTER 4CHAPTER 4
CHAPTER 4
 
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
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]
 
C Basics
C BasicsC Basics
C Basics
 
Input And Output
 Input And Output Input And Output
Input And Output
 
Programming Fundamentals lecture 5
Programming Fundamentals lecture 5Programming Fundamentals lecture 5
Programming Fundamentals lecture 5
 
Lecture 8- Data Input and Output
Lecture 8- Data Input and OutputLecture 8- Data Input and Output
Lecture 8- Data Input and Output
 
Chapter3
Chapter3Chapter3
Chapter3
 
Presention programming
Presention programmingPresention programming
Presention programming
 
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
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
 
2 data and c
2 data and c2 data and c
2 data and c
 
Unit 2- Module 2.pptx
Unit 2- Module 2.pptxUnit 2- Module 2.pptx
Unit 2- Module 2.pptx
 
Programming in C.pptx
Programming in C.pptxProgramming in C.pptx
Programming in C.pptx
 
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C Language
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptx
 
c_pro_introduction.pptx
c_pro_introduction.pptxc_pro_introduction.pptx
c_pro_introduction.pptx
 
Lesson 7 io statements
Lesson 7 io statementsLesson 7 io statements
Lesson 7 io statements
 
Input and output basic of c++ programming and escape sequences
Input and output basic of c++ programming and escape sequencesInput and output basic of c++ programming and escape sequences
Input and output basic of c++ programming and escape sequences
 

Mehr von Sabik T S

Managers roles and skills
Managers roles and skillsManagers roles and skills
Managers roles and skillsSabik T S
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programmingSabik T S
 
Algorithm and Flowcharts
Algorithm and FlowchartsAlgorithm and Flowcharts
Algorithm and FlowchartsSabik T S
 
decision table training session
decision table training sessiondecision table training session
decision table training sessionSabik T S
 
cover letter
cover lettercover letter
cover letterSabik T S
 
pseudo code basics
pseudo code basicspseudo code basics
pseudo code basicsSabik T S
 
Types of welding
Types of welding Types of welding
Types of welding Sabik T S
 

Mehr von Sabik T S (7)

Managers roles and skills
Managers roles and skillsManagers roles and skills
Managers roles and skills
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
Algorithm and Flowcharts
Algorithm and FlowchartsAlgorithm and Flowcharts
Algorithm and Flowcharts
 
decision table training session
decision table training sessiondecision table training session
decision table training session
 
cover letter
cover lettercover letter
cover letter
 
pseudo code basics
pseudo code basicspseudo code basics
pseudo code basics
 
Types of welding
Types of welding Types of welding
Types of welding
 

Kürzlich hochgeladen

diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...Krashi Coaching
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryCeline George
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Denish Jangid
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...Nguyen Thanh Tu Collection
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Mohamed Rizk Khodair
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMELOISARIVERA8
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/siemaillard
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45MysoreMuleSoftMeetup
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 

Kürzlich hochgeladen (20)

diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 

Data Input and Output

  • 1. DATA INPUT AND OUTPUT
  • 2. INPUT/OUTPUT IN C  C has no built-in statements for input or output.  A library of functions is supplied to perform these operations. The I/O library functions are listed the “header” file <stdio.h>.  You do not need to memorize them, just be familiar with them.
  • 3. STREAMS  All input and output is performed with streams.  A "stream" is a sequence of characters organized into lines.  Each line consists of zero or more characters and ends with the "newline" character.
  • 4. TYPES OF STREAMS IN C  Standard input stream is called "stdin" and is normally connected to the keyboard  Standard output stream is called "stdout" and is normally connected to the display screen.  Standard error stream is called "stderr" and is also normally connected to the screen
  • 5. I/O FUNCTIONS IN C  There are six i/o functions in C are:  1. getchar()  2. putchar()  3. printf()  4.scanf()  5.gets()  6.puts()
  • 6. GETCHAR()  getchar();  Single character can be entered in computer using C.  Example:  Char c;  …………  …….  C=getchar();
  • 7. PUTCHAR()  putchar();  It is used to display single char.  Example char c=‘H’; putchar(c);
  • 8. SCANF scanf ( ) ;  This function provides for formatted input from the keyboard. The syntax is: scanf ( “format” , &var1, &var2, …) ;  The “format” is a listing of the data types of the variables to be input and the & in front of each variable name tells the system WHERE to store the value that is input. It provides the address for the variable.  Example: float a; int b; scanf (“%f%d”, &a, &b
  • 9. FORMAT OF DATA  Format Conversion Specifiers: d -- displays a decimal (base 10) integer l -- used with other specifies to indicate a "long" e -- displays a floating point value in exponential notation f -- displays a floating point value g -- displays a number in either "e" or "f" format c -- displays a single character s -- displays a string of characters
  • 10. STRINGS  When you enter string data the compiler automatically add 0 in the end of string;  Char name[22];  gets(name);  ‘ROHIT’  But actual value stored in computer is ‘ROHIT0’
  • 11. PRINTF  This function provides for formatted output to the screen. The syntax is: printf ( “format”, var1, var2, … ) ;  The “format” includes a listing of the data types of the variables to be output and, optionally, some text and control character(s).  Example: float a ; int b ; scanf ( “%f%d”, &a, &b ) ; printf ( “You entered %f and %d n”, a, b ) ;
  • 12. GETS AND PUTS  To input a string to computer  gets(name);  Puts is used to display string data on screen  puts(name);