SlideShare a Scribd company logo
“
”
Managing input and output
operations in c
CREATED BY NIYAMATH
INDEX
INTRODUCTION
UNFORMATED INPUT AND OUTPUT FUNCTION
FORMATTED INPUT
FORMATTED OUTPUT
 SOFTWARE ENGINEERING
TIPES
INTRODUCTION
 C Does not contain any build in function in input and output function.
 C carrys input and output operations in library function like printf() and scanf().
 In standared I/O operations include header file called stdio.h
 C program using must begin with the statement
FUNCTIONS
1. Scanf( )
2. Printf( )
3. Getchar( )
4. Putchar( )
5. Gets( )
6. Puts( )
This all functions are transfers data between computers and standard I/O devices
like monitors and keyboard
UNFORMETTED I/O FUNCTIONS
 Getchar( ):-
It is used to accept a single character using library function in a c program
syntax:- variable_name=getchar( );
 Putchar( ):-
single characters can be displayed using the library function putchar( ).
syntax:- putchar(variable_name);
 Gets( ):-
This function is used to read a string from the keyboard if input device is not specified.
syntax:- gets(string);
 Puts( ):-
It is used to print sting type of data.it also takes single arguments.
syntax:- puts(expression);
FORMATTED TNPUT with (scanf( ))
 The scanf() function is used to input data in a formatted manner.
syntax:- scanf(“control string”,list of address of variables);
or
scanf(“control sting”,&var1,&var2,…………….,&varn);
 In c to represent an address of any location an ampersand(&)is used.
 Scanf() ignores all leading spaces,blanks,tabs,newlines etc.
 Scanf() can also used to read a sting of characters.
FORMAT OF DATA TYPE CHARACTER IN
SCANF( ).
DATA TYPE
INTEGER integer
short
short unsigned
long
long assigned
hexadecimal
long hexa
octal
REAL float,double
CHARACTER
STING
FORMAT
%d
%d
%u
%id
%iu
%x
%ix
%o(letter 0)
%f,%if,%g
%c
%s
FORMATTED OUTPUT WITH (printf( )).
 C provides inbuilt function in library stdio.h known as printf( )
 The printf() moves data from computers memory to standard output device
syntax:- printf(“control string”,var1,var2,………,var n);
 The control sting entries are usually separated by spaces and precedence.
FORMAT OF DATA TYPE CONVERSION IN
PRINTF( ).
DATA TYPE
INTEGER integer
short
short unsigned
long
long assigned
hexa
long hexa
octal
long octal
REAL float
double
Character
string
FORMAT
%d
%d
%u
%id
%iu
%x
%ix
%o(letter 0)
%io
%f,%g
%if,%e,%e
%c
%s
PRINTING INTEGERS
 PRINTING INTEGER:-
An integer is a whole number ,when field width specified is greater
than the number,leading blanks are included.
when the field width is not specified or when the width is less than
the number to be printed.
%wd right justifies the output
%-wd left justifies the output
%0wd right justifies the output
FORMAT
PRINTING A SINGLE CHARACTER
 Single characters can be printed in the required position by using the format.
 %wc gives right justified output
%-wc gives left justified output
ex:-
char ch=‘A’
printf(“%5c%c”,ch,ch);
output:-
A A
%c or %wc
PRINTNG STRING
 Stings are generally printed using the format
%ws leads to left justified output
%-ws leads to right justified output
 Escape sequence (tab space) can be used to insert space between outputs.
%s or %ws
Printf(“%s”,name);
Printf(“%10s”,name);
Printf(“%20s”,name);
Printf(“-20”,name);
SOFTWARE ENGINEERING
1) Program documentation has 2 levels are:-
a) General documentation:-
it starts at the beginning of any program containing the following
commet statements:
1. name.
2. Name of auther.
3. Data of first version written
b) Modular documentation:-
it consists of brief description using comments for every block
code.each block code must be separated by a blank line.
2) Data names:-
1. Dataname must be as close as possible to the general terminology used.
2. Dataname must not be too short or abbreviated so much that they lose their
identity.
3. In long datanames the first letter of each word can be capitalized such as ProductID
4. Do not create datanames that are too similar especially when there Is difference of only
one or two letters.
5. try to avoid using generic datanames such as sum,total,emp etc.

More Related Content

What's hot

Java static keyword
Java static keywordJava static keyword
Java static keyword
Lovely Professional University
 
friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)
Ritika Sharma
 
11 lec 11 storage class
11 lec 11 storage class11 lec 11 storage class
11 lec 11 storage classkapil078
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
Dr Sukhpal Singh Gill
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
Vineeta Garg
 
Arrays in c
Arrays in cArrays in c
Arrays in c
Jeeva Nanthini
 
Type casting in java
Type casting in javaType casting in java
Type casting in java
Farooq Baloch
 
Data types in c++
Data types in c++Data types in c++
Data types in c++
Venkata.Manish Reddy
 
Functions in c
Functions in cFunctions in c
Functions in c
sunila tharagaturi
 
Union in c language
Union  in c languageUnion  in c language
Union in c language
tanmaymodi4
 
Inline function
Inline functionInline function
Inline functionTech_MX
 
Function in c
Function in cFunction in c
Function in c
savitamhaske
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
programming9
 
Structure in C
Structure in CStructure in C
Structure in C
Kamal Acharya
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
Anil Pokhrel
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and DestructorKamal Acharya
 
Call by value
Call by valueCall by value
Call by valueDharani G
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
Neeru Mittal
 
Constructors and Destructor in C++
Constructors and Destructor in C++Constructors and Destructor in C++

What's hot (20)

Java static keyword
Java static keywordJava static keyword
Java static keyword
 
friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)
 
11 lec 11 storage class
11 lec 11 storage class11 lec 11 storage class
11 lec 11 storage class
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
 
Methods in Java
Methods in JavaMethods in Java
Methods in Java
 
Arrays in c
Arrays in cArrays in c
Arrays in c
 
Type casting in java
Type casting in javaType casting in java
Type casting in java
 
Data types in c++
Data types in c++Data types in c++
Data types in c++
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Union in c language
Union  in c languageUnion  in c language
Union in c language
 
Inline function
Inline functionInline function
Inline function
 
Function in c
Function in cFunction in c
Function in c
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
 
Structure in C
Structure in CStructure in C
Structure in C
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and Destructor
 
Call by value
Call by valueCall by value
Call by value
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
 
Constructors and Destructor in C++
Constructors and Destructor in C++Constructors and Destructor in C++
Constructors and Destructor in C++
 

Similar to Managing input and output operations 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
SowmyaJyothi3
 
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
Thesis Scientist Private Limited
 
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 Function
imtiazalijoono
 
Functions of stdio conio
Functions of stdio   conio Functions of stdio   conio
Functions of stdio conio
Bhavik Vashi
 
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C Language
Adnan Khan
 
Data Input and Output
Data Input and OutputData Input and Output
Data Input and Output
Sabik T S
 
CPU INPUT OUTPUT
CPU INPUT OUTPUT CPU INPUT OUTPUT
CPU INPUT OUTPUT
Aditya Vaishampayan
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
JavvajiVenkat
 
I o functions
I o functionsI o functions
I o functions
Dr.Sandhiya Ravi
 
Lecture 8- Data Input and Output
Lecture 8- Data Input and OutputLecture 8- Data Input and Output
Lecture 8- Data Input and Output
Md. Imran Hossain Showrov
 
CHAPTER 4
CHAPTER 4CHAPTER 4
CHAPTER 4
mohd_mizan
 
CP Handout#2
CP Handout#2CP Handout#2
CP Handout#2
trupti1976
 
Cse115 lecture04introtoc programming
Cse115 lecture04introtoc programmingCse115 lecture04introtoc programming
Cse115 lecture04introtoc programming
Md. Ashikur Rahman
 
2.1 input and output in c
2.1 input and output in c2.1 input and output in c
2.1 input and output in c
Jawad Khan
 
2 data and c
2 data and c2 data and c
2 data and c
MomenMostafa
 

Similar to Managing input and output operations in c (20)

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
 
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]
 
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
 
Input And Output
 Input And Output Input And Output
Input And Output
 
Functions of stdio conio
Functions of stdio   conio Functions of stdio   conio
Functions of stdio conio
 
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C Language
 
Data Input and Output
Data Input and OutputData Input and Output
Data Input and Output
 
CPU INPUT OUTPUT
CPU INPUT OUTPUT CPU INPUT OUTPUT
CPU INPUT OUTPUT
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
I o functions
I o functionsI o functions
I o functions
 
Lecture 8- Data Input and Output
Lecture 8- Data Input and OutputLecture 8- Data Input and Output
Lecture 8- Data Input and Output
 
Basic Input and Output
Basic Input and OutputBasic Input and Output
Basic Input and Output
 
CHAPTER 4
CHAPTER 4CHAPTER 4
CHAPTER 4
 
CP Handout#2
CP Handout#2CP Handout#2
CP Handout#2
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
Cse115 lecture04introtoc programming
Cse115 lecture04introtoc programmingCse115 lecture04introtoc programming
Cse115 lecture04introtoc programming
 
2.1 input and output in c
2.1 input and output in c2.1 input and output in c
2.1 input and output in c
 
2 data and c
2 data and c2 data and c
2 data and c
 

Recently uploaded

Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 

Recently uploaded (20)

Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 

Managing input and output operations in c

  • 1. “ ” Managing input and output operations in c CREATED BY NIYAMATH
  • 2. INDEX INTRODUCTION UNFORMATED INPUT AND OUTPUT FUNCTION FORMATTED INPUT FORMATTED OUTPUT  SOFTWARE ENGINEERING TIPES
  • 3. INTRODUCTION  C Does not contain any build in function in input and output function.  C carrys input and output operations in library function like printf() and scanf().  In standared I/O operations include header file called stdio.h  C program using must begin with the statement
  • 4. FUNCTIONS 1. Scanf( ) 2. Printf( ) 3. Getchar( ) 4. Putchar( ) 5. Gets( ) 6. Puts( ) This all functions are transfers data between computers and standard I/O devices like monitors and keyboard
  • 5. UNFORMETTED I/O FUNCTIONS  Getchar( ):- It is used to accept a single character using library function in a c program syntax:- variable_name=getchar( );  Putchar( ):- single characters can be displayed using the library function putchar( ). syntax:- putchar(variable_name);  Gets( ):- This function is used to read a string from the keyboard if input device is not specified. syntax:- gets(string);
  • 6.  Puts( ):- It is used to print sting type of data.it also takes single arguments. syntax:- puts(expression);
  • 7. FORMATTED TNPUT with (scanf( ))  The scanf() function is used to input data in a formatted manner. syntax:- scanf(“control string”,list of address of variables); or scanf(“control sting”,&var1,&var2,…………….,&varn);  In c to represent an address of any location an ampersand(&)is used.  Scanf() ignores all leading spaces,blanks,tabs,newlines etc.  Scanf() can also used to read a sting of characters.
  • 8. FORMAT OF DATA TYPE CHARACTER IN SCANF( ). DATA TYPE INTEGER integer short short unsigned long long assigned hexadecimal long hexa octal REAL float,double CHARACTER STING FORMAT %d %d %u %id %iu %x %ix %o(letter 0) %f,%if,%g %c %s
  • 9. FORMATTED OUTPUT WITH (printf( )).  C provides inbuilt function in library stdio.h known as printf( )  The printf() moves data from computers memory to standard output device syntax:- printf(“control string”,var1,var2,………,var n);  The control sting entries are usually separated by spaces and precedence.
  • 10. FORMAT OF DATA TYPE CONVERSION IN PRINTF( ). DATA TYPE INTEGER integer short short unsigned long long assigned hexa long hexa octal long octal REAL float double Character string FORMAT %d %d %u %id %iu %x %ix %o(letter 0) %io %f,%g %if,%e,%e %c %s
  • 11. PRINTING INTEGERS  PRINTING INTEGER:- An integer is a whole number ,when field width specified is greater than the number,leading blanks are included. when the field width is not specified or when the width is less than the number to be printed. %wd right justifies the output %-wd left justifies the output %0wd right justifies the output
  • 13. PRINTING A SINGLE CHARACTER  Single characters can be printed in the required position by using the format.  %wc gives right justified output %-wc gives left justified output ex:- char ch=‘A’ printf(“%5c%c”,ch,ch); output:- A A %c or %wc
  • 14. PRINTNG STRING  Stings are generally printed using the format %ws leads to left justified output %-ws leads to right justified output  Escape sequence (tab space) can be used to insert space between outputs. %s or %ws Printf(“%s”,name); Printf(“%10s”,name); Printf(“%20s”,name); Printf(“-20”,name);
  • 15. SOFTWARE ENGINEERING 1) Program documentation has 2 levels are:- a) General documentation:- it starts at the beginning of any program containing the following commet statements: 1. name. 2. Name of auther. 3. Data of first version written b) Modular documentation:- it consists of brief description using comments for every block code.each block code must be separated by a blank line.
  • 16. 2) Data names:- 1. Dataname must be as close as possible to the general terminology used. 2. Dataname must not be too short or abbreviated so much that they lose their identity. 3. In long datanames the first letter of each word can be capitalized such as ProductID 4. Do not create datanames that are too similar especially when there Is difference of only one or two letters. 5. try to avoid using generic datanames such as sum,total,emp etc.