SlideShare a Scribd company logo
11
Matlab Programming Tips
Part 2– Input / Output Commands (Review)
by
Shameer Koya
input Command
 input - Prompt for user input.
 Input is the simple basic command to request the
user input.
 Displays a prompt text for the user to understand
what data to be entered and waits for the user to
input a value and press the Return key.
 i = input('Enter the current value:')
 str = input(‘text’,'s') returns the entered text as a MATLAB
string, without evaluating expressions.
2
sscanf Command
 Read data as string and convert to the other formats
based on the definition.
 X = sscanf(str, format, size)
 Reads data from the vector str, converts it according to the
format, and store the results in array X.
 Argument ‘size’ is optional.
3
disp Command
 disp - (display) command displays variable values
or text on screen
 Displays each time on new line.
 Doesn't print variable name
 disp(variable_name) or disp('text string')
4
fprintf Command
 fprintf - Means file print formatted
 'fprintf' is used to formats data and displays the
results on the screen and to write the data in to a text
file.
 Can write to screen or to a file
 Can mix numbers and text in output
 Have full control of output display
 Basic Syntax is
 fprintf('Text to display')
5
 >> fprintf( 'How are you' )
 How are you>>
 Problem – Command Window displays prompt (>>) at end of text,
not at start of next line!
 To make the prompt to appear on the start of a new line,
n at the end of the fprintf text
 >> fprintf( Electrical Engineeringn' )
 Electrical Engineering
 >>
 Use n in middle of text to make MATLAB display
remainder of text on next line
 >> fprintf(' Electrical nEngineering')
 Electrical
 Engineering
6
fprintf …
 To format the display data, the formatting operators
are used.
 A formatting operator starts with a percentage
sign, %, and ends with a conversion character.
 Common conversion specifiers:
 %f fixed point (decimal always between 1's and 0.1's place,
e.g., 3.14, 56.8
 %e scientific notation, e.g, 2.99e+008
 %d integers (no decimal point shown)
 %s string of characters
 >> fprintf( 'Joe is %d weighs %f kilos', age,
weight )
 >> fprintf( 'Joe weighs %f kilos', n1 )
7
fprintf to format the output
fprintf to format the output …
 Examples
 >> age = 35;
 >> weight = 75.25;
 >> fprintf( 'Joe is %d weighs %f kilosn', age, weight )
 Joe is 35 weighs 75.250000 kilos
 >> fprintf( 'Joe weighs %4.4f kilosn', weight )
 Joe weighs 75.2500 kilos
 >> fprintf( 'Joe weighs %4.2f kilosn', weight )
 Joe weighs 75.25 kilos
8
fprintf to format the output…
 To display a percent sign, use %% in the text
 To display a single quote, use ' ' in the text (two
sequential single quotes)
 To display a backslash, use  in the text (two
sequential backslashes)
9
Ad

Recommended

Matlab Functions
Matlab Functions
Umer Azeem
 
Python strings presentation
Python strings presentation
VedaGayathri1
 
Procedure and Functions in pl/sql
Procedure and Functions in pl/sql
Ñirmal Tatiwal
 
How to use Map() Filter() and Reduce() functions in Python | Edureka
How to use Map() Filter() and Reduce() functions in Python | Edureka
Edureka!
 
Python Pandas
Python Pandas
Sunil OS
 
Complexity analysis in Algorithms
Complexity analysis in Algorithms
Daffodil International University
 
Python : Data Types
Python : Data Types
Emertxe Information Technologies Pvt Ltd
 
Introduction to c#
Introduction to c#
OpenSource Technologies Pvt. Ltd.
 
Matlab Script - Loop Control
Matlab Script - Loop Control
Shameer Ahmed Koya
 
10. funtions and closures IN SWIFT PROGRAMMING
10. funtions and closures IN SWIFT PROGRAMMING
LOVELY PROFESSIONAL UNIVERSITY
 
Mysql joins
Mysql joins
baabtra.com - No. 1 supplier of quality freshers
 
Algorithm Design Technique
Algorithm Design Technique
Bharat Bhushan
 
Destructors
Destructors
DeepikaT13
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumar
Sujith Kumar
 
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
Shail Nakum
 
Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programming
Abha Damani
 
User defined functions in C
User defined functions in C
Harendra Singh
 
Python GUI
Python GUI
LusciousLarryDas
 
Python - Data Structures
Python - Data Structures
NR Computer Learning Center
 
Map, Filter and Reduce In Python
Map, Filter and Reduce In Python
Simplilearn
 
Introduction to Python Pandas for Data Analytics
Introduction to Python Pandas for Data Analytics
Phoenix
 
Chapter 6 algorithms and flow charts
Chapter 6 algorithms and flow charts
Praveen M Jigajinni
 
Built in function
Built in function
MD. Rayhanul Islam Sayket
 
Strings in python
Strings in python
Prabhakaran V M
 
Hands on Session on Python
Hands on Session on Python
Sumit Raj
 
Exception handling c++
Exception handling c++
Jayant Dalvi
 
List in Python
List in Python
Sharath Ankrajegowda
 
Database connectivity in python
Database connectivity in python
baabtra.com - No. 1 supplier of quality freshers
 
Conditional Control in MATLAB Scripts
Conditional Control in MATLAB Scripts
Shameer Ahmed Koya
 
Anonymous and Inline Functions in MATLAB
Anonymous and Inline Functions in MATLAB
Shameer Ahmed Koya
 

More Related Content

What's hot (20)

Matlab Script - Loop Control
Matlab Script - Loop Control
Shameer Ahmed Koya
 
10. funtions and closures IN SWIFT PROGRAMMING
10. funtions and closures IN SWIFT PROGRAMMING
LOVELY PROFESSIONAL UNIVERSITY
 
Mysql joins
Mysql joins
baabtra.com - No. 1 supplier of quality freshers
 
Algorithm Design Technique
Algorithm Design Technique
Bharat Bhushan
 
Destructors
Destructors
DeepikaT13
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumar
Sujith Kumar
 
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
Shail Nakum
 
Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programming
Abha Damani
 
User defined functions in C
User defined functions in C
Harendra Singh
 
Python GUI
Python GUI
LusciousLarryDas
 
Python - Data Structures
Python - Data Structures
NR Computer Learning Center
 
Map, Filter and Reduce In Python
Map, Filter and Reduce In Python
Simplilearn
 
Introduction to Python Pandas for Data Analytics
Introduction to Python Pandas for Data Analytics
Phoenix
 
Chapter 6 algorithms and flow charts
Chapter 6 algorithms and flow charts
Praveen M Jigajinni
 
Built in function
Built in function
MD. Rayhanul Islam Sayket
 
Strings in python
Strings in python
Prabhakaran V M
 
Hands on Session on Python
Hands on Session on Python
Sumit Raj
 
Exception handling c++
Exception handling c++
Jayant Dalvi
 
List in Python
List in Python
Sharath Ankrajegowda
 
Database connectivity in python
Database connectivity in python
baabtra.com - No. 1 supplier of quality freshers
 
Algorithm Design Technique
Algorithm Design Technique
Bharat Bhushan
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumar
Sujith Kumar
 
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
Shail Nakum
 
Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programming
Abha Damani
 
User defined functions in C
User defined functions in C
Harendra Singh
 
Map, Filter and Reduce In Python
Map, Filter and Reduce In Python
Simplilearn
 
Introduction to Python Pandas for Data Analytics
Introduction to Python Pandas for Data Analytics
Phoenix
 
Chapter 6 algorithms and flow charts
Chapter 6 algorithms and flow charts
Praveen M Jigajinni
 
Hands on Session on Python
Hands on Session on Python
Sumit Raj
 
Exception handling c++
Exception handling c++
Jayant Dalvi
 

Viewers also liked (6)

Conditional Control in MATLAB Scripts
Conditional Control in MATLAB Scripts
Shameer Ahmed Koya
 
Anonymous and Inline Functions in MATLAB
Anonymous and Inline Functions in MATLAB
Shameer Ahmed Koya
 
MATLAB Scripts - Examples
MATLAB Scripts - Examples
Shameer Ahmed Koya
 
User defined Functions in MATLAB Part 1
User defined Functions in MATLAB Part 1
Shameer Ahmed Koya
 
User Defined Functions in MATLAB Part-4
User Defined Functions in MATLAB Part-4
Shameer Ahmed Koya
 
Matlab Introduction
Matlab Introduction
Daniel Moore
 
Conditional Control in MATLAB Scripts
Conditional Control in MATLAB Scripts
Shameer Ahmed Koya
 
Anonymous and Inline Functions in MATLAB
Anonymous and Inline Functions in MATLAB
Shameer Ahmed Koya
 
User defined Functions in MATLAB Part 1
User defined Functions in MATLAB Part 1
Shameer Ahmed Koya
 
User Defined Functions in MATLAB Part-4
User Defined Functions in MATLAB Part-4
Shameer Ahmed Koya
 
Matlab Introduction
Matlab Introduction
Daniel Moore
 
Ad

Similar to MATLAB programming tips 2 - Input and Output Commands (20)

Introduction to matlab
Introduction to matlab
Mohan Raj
 
Python variables in the computer science.pptx
Python variables in the computer science.pptx
Rajasekhar364622
 
POEPPSGNHwkejnkweoewnkenjwjewkjewoewkjewijewjk
POEPPSGNHwkejnkweoewnkenjwjewkjewoewkjewijewjk
hanumanthumanideeph6
 
Functions of stdio conio
Functions of stdio conio
Bhavik Vashi
 
miniLesson on the printf() function
miniLesson on the printf() function
Christine Wolfe
 
To be able to add user input to m-files To be able to control the output fro...
To be able to add user input to m-files To be able to control the output fro...
AliALKHAYYAT8
 
8. MATLAB can generate random numbers using the rand command. rand on its own...
8. MATLAB can generate random numbers using the rand command. rand on its own...
AliALKHAYYAT8
 
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
SowmyaJyothi3
 
Beginning with vi text editor
Beginning with vi text editor
Jose Pla
 
1. Ch_1 SL_1_Intro to Matlab.pptx
1. Ch_1 SL_1_Intro to Matlab.pptx
MOHAMMAD SAYDUL ALAM
 
Lecture 8- Data Input and Output
Lecture 8- Data Input and Output
Md. Imran Hossain Showrov
 
Diploma ii cfpc u-4 function, storage class and array and strings
Diploma ii cfpc u-4 function, storage class and array and strings
Rai University
 
Introduction to Input/Output Functions in C
Introduction to Input/Output Functions in C
Thesis Scientist Private Limited
 
Lecture-2.pptxefygefyeyyegfygcyewvwvvcvywcy
Lecture-2.pptxefygefyeyyegfygcyewvwvvcvywcy
hamzah7958
 
Each n Every topic of C Programming.pptx
Each n Every topic of C Programming.pptx
snnbarot
 
Mcai pic u 4 function, storage class and array and strings
Mcai pic u 4 function, storage class and array and strings
Rai University
 
Input And Output
Input And Output
Ghaffar Khan
 
Btech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and strings
Rai University
 
Functions torage class and array and strings-
Functions torage class and array and strings-
aneebkmct
 
function, storage class and array and strings
function, storage class and array and strings
Rai University
 
Introduction to matlab
Introduction to matlab
Mohan Raj
 
Python variables in the computer science.pptx
Python variables in the computer science.pptx
Rajasekhar364622
 
POEPPSGNHwkejnkweoewnkenjwjewkjewoewkjewijewjk
POEPPSGNHwkejnkweoewnkenjwjewkjewoewkjewijewjk
hanumanthumanideeph6
 
Functions of stdio conio
Functions of stdio conio
Bhavik Vashi
 
miniLesson on the printf() function
miniLesson on the printf() function
Christine Wolfe
 
To be able to add user input to m-files To be able to control the output fro...
To be able to add user input to m-files To be able to control the output fro...
AliALKHAYYAT8
 
8. MATLAB can generate random numbers using the rand command. rand on its own...
8. MATLAB can generate random numbers using the rand command. rand on its own...
AliALKHAYYAT8
 
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
SowmyaJyothi3
 
Beginning with vi text editor
Beginning with vi text editor
Jose Pla
 
Diploma ii cfpc u-4 function, storage class and array and strings
Diploma ii cfpc u-4 function, storage class and array and strings
Rai University
 
Lecture-2.pptxefygefyeyyegfygcyewvwvvcvywcy
Lecture-2.pptxefygefyeyyegfygcyewvwvvcvywcy
hamzah7958
 
Each n Every topic of C Programming.pptx
Each n Every topic of C Programming.pptx
snnbarot
 
Mcai pic u 4 function, storage class and array and strings
Mcai pic u 4 function, storage class and array and strings
Rai University
 
Btech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and strings
Rai University
 
Functions torage class and array and strings-
Functions torage class and array and strings-
aneebkmct
 
function, storage class and array and strings
function, storage class and array and strings
Rai University
 
Ad

More from Shameer Ahmed Koya (7)

User Defined Functions in MATLAB part 2
User Defined Functions in MATLAB part 2
Shameer Ahmed Koya
 
MATLAB Programming - Loop Control Part 2
MATLAB Programming - Loop Control Part 2
Shameer Ahmed Koya
 
Introduction to Matlab Scripts
Introduction to Matlab Scripts
Shameer Ahmed Koya
 
Matlab Programming Tips Part 1
Matlab Programming Tips Part 1
Shameer Ahmed Koya
 
Polynomials and Curve Fitting in MATLAB
Polynomials and Curve Fitting in MATLAB
Shameer Ahmed Koya
 
MATLAB - Aplication of Arrays and Matrices in Electrical Systems
MATLAB - Aplication of Arrays and Matrices in Electrical Systems
Shameer Ahmed Koya
 
MATLAB - Arrays and Matrices
MATLAB - Arrays and Matrices
Shameer Ahmed Koya
 
User Defined Functions in MATLAB part 2
User Defined Functions in MATLAB part 2
Shameer Ahmed Koya
 
MATLAB Programming - Loop Control Part 2
MATLAB Programming - Loop Control Part 2
Shameer Ahmed Koya
 
Introduction to Matlab Scripts
Introduction to Matlab Scripts
Shameer Ahmed Koya
 
Matlab Programming Tips Part 1
Matlab Programming Tips Part 1
Shameer Ahmed Koya
 
Polynomials and Curve Fitting in MATLAB
Polynomials and Curve Fitting in MATLAB
Shameer Ahmed Koya
 
MATLAB - Aplication of Arrays and Matrices in Electrical Systems
MATLAB - Aplication of Arrays and Matrices in Electrical Systems
Shameer Ahmed Koya
 

Recently uploaded (20)

K12 Tableau User Group virtual event June 18, 2025
K12 Tableau User Group virtual event June 18, 2025
dogden2
 
A Visual Introduction to the Prophet Jeremiah
A Visual Introduction to the Prophet Jeremiah
Steve Thomason
 
English 3 Quarter 1_LEwithLAS_Week 1.pdf
English 3 Quarter 1_LEwithLAS_Week 1.pdf
DeAsisAlyanajaneH
 
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
jutaydeonne
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
sumadsadjelly121997
 
Vitamin and Nutritional Deficiencies.pptx
Vitamin and Nutritional Deficiencies.pptx
Vishal Chanalia
 
Hurricane Helene Application Documents Checklists
Hurricane Helene Application Documents Checklists
Mebane Rash
 
How to use search fetch method in Odoo 18
How to use search fetch method in Odoo 18
Celine George
 
Paper 106 | Ambition and Corruption: A Comparative Analysis of ‘The Great Gat...
Paper 106 | Ambition and Corruption: A Comparative Analysis of ‘The Great Gat...
Rajdeep Bavaliya
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
trjnesjnqg7801
 
NSUMD_M1 Library Orientation_June 11, 2025.pptx
NSUMD_M1 Library Orientation_June 11, 2025.pptx
Julie Sarpy
 
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
ErlizaRosete
 
HistoPathology Ppt. Arshita Gupta for Diploma
HistoPathology Ppt. Arshita Gupta for Diploma
arshitagupta674
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 6-14-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 6-14-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
IIT Kharagpur Quiz Club
 
INDUCTIVE EFFECT slide for first prof pharamacy students
INDUCTIVE EFFECT slide for first prof pharamacy students
SHABNAM FAIZ
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
K12 Tableau User Group virtual event June 18, 2025
K12 Tableau User Group virtual event June 18, 2025
dogden2
 
A Visual Introduction to the Prophet Jeremiah
A Visual Introduction to the Prophet Jeremiah
Steve Thomason
 
English 3 Quarter 1_LEwithLAS_Week 1.pdf
English 3 Quarter 1_LEwithLAS_Week 1.pdf
DeAsisAlyanajaneH
 
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
jutaydeonne
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
sumadsadjelly121997
 
Vitamin and Nutritional Deficiencies.pptx
Vitamin and Nutritional Deficiencies.pptx
Vishal Chanalia
 
Hurricane Helene Application Documents Checklists
Hurricane Helene Application Documents Checklists
Mebane Rash
 
How to use search fetch method in Odoo 18
How to use search fetch method in Odoo 18
Celine George
 
Paper 106 | Ambition and Corruption: A Comparative Analysis of ‘The Great Gat...
Paper 106 | Ambition and Corruption: A Comparative Analysis of ‘The Great Gat...
Rajdeep Bavaliya
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
trjnesjnqg7801
 
NSUMD_M1 Library Orientation_June 11, 2025.pptx
NSUMD_M1 Library Orientation_June 11, 2025.pptx
Julie Sarpy
 
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
ErlizaRosete
 
HistoPathology Ppt. Arshita Gupta for Diploma
HistoPathology Ppt. Arshita Gupta for Diploma
arshitagupta674
 
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
IIT Kharagpur Quiz Club
 
INDUCTIVE EFFECT slide for first prof pharamacy students
INDUCTIVE EFFECT slide for first prof pharamacy students
SHABNAM FAIZ
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 

MATLAB programming tips 2 - Input and Output Commands

  • 1. 11 Matlab Programming Tips Part 2– Input / Output Commands (Review) by Shameer Koya
  • 2. input Command  input - Prompt for user input.  Input is the simple basic command to request the user input.  Displays a prompt text for the user to understand what data to be entered and waits for the user to input a value and press the Return key.  i = input('Enter the current value:')  str = input(‘text’,'s') returns the entered text as a MATLAB string, without evaluating expressions. 2
  • 3. sscanf Command  Read data as string and convert to the other formats based on the definition.  X = sscanf(str, format, size)  Reads data from the vector str, converts it according to the format, and store the results in array X.  Argument ‘size’ is optional. 3
  • 4. disp Command  disp - (display) command displays variable values or text on screen  Displays each time on new line.  Doesn't print variable name  disp(variable_name) or disp('text string') 4
  • 5. fprintf Command  fprintf - Means file print formatted  'fprintf' is used to formats data and displays the results on the screen and to write the data in to a text file.  Can write to screen or to a file  Can mix numbers and text in output  Have full control of output display  Basic Syntax is  fprintf('Text to display') 5
  • 6.  >> fprintf( 'How are you' )  How are you>>  Problem – Command Window displays prompt (>>) at end of text, not at start of next line!  To make the prompt to appear on the start of a new line, n at the end of the fprintf text  >> fprintf( Electrical Engineeringn' )  Electrical Engineering  >>  Use n in middle of text to make MATLAB display remainder of text on next line  >> fprintf(' Electrical nEngineering')  Electrical  Engineering 6 fprintf …
  • 7.  To format the display data, the formatting operators are used.  A formatting operator starts with a percentage sign, %, and ends with a conversion character.  Common conversion specifiers:  %f fixed point (decimal always between 1's and 0.1's place, e.g., 3.14, 56.8  %e scientific notation, e.g, 2.99e+008  %d integers (no decimal point shown)  %s string of characters  >> fprintf( 'Joe is %d weighs %f kilos', age, weight )  >> fprintf( 'Joe weighs %f kilos', n1 ) 7 fprintf to format the output
  • 8. fprintf to format the output …  Examples  >> age = 35;  >> weight = 75.25;  >> fprintf( 'Joe is %d weighs %f kilosn', age, weight )  Joe is 35 weighs 75.250000 kilos  >> fprintf( 'Joe weighs %4.4f kilosn', weight )  Joe weighs 75.2500 kilos  >> fprintf( 'Joe weighs %4.2f kilosn', weight )  Joe weighs 75.25 kilos 8
  • 9. fprintf to format the output…  To display a percent sign, use %% in the text  To display a single quote, use ' ' in the text (two sequential single quotes)  To display a backslash, use in the text (two sequential backslashes) 9