SlideShare a Scribd company logo
6
Most read
7
Most read
8
Most read
Matlab Scripts
 Conditional control – if, else, switch
 Loop control – for, while, continue, break
 Program termination – return
2
if, else, and elseif for while
if test statement
statements
elseif test statement
statements
else
statements
end
3
if I == J
A(I,J) = 2;
elseif abs(I-J) ==
1
A(I,J) = -1;
else
A(I,J) = 0;
end
• Conditional statements are commands that allows MATLAB to
decide whether or not to execute some code that follows the
statement
• Conditional statements use relational operators like
==,~=,>,< (Note that are all scalar tests)
 If the
conditional
expression is
true, MATLAB
runs the lines of
code that are
between the
line with if
and the line
with end.
 If the
conditional
expression is
false, MATLAB
skips the code
between if
and the line
with else and
runs the code up
to end.
height=input(‘Plz enter the height:‘)
if height>170
disp('tall')
elseif height<150
disp('small')
else
disp('average')
end
A program to make a discount of 20% if the no. of
books are greater than 5
clc;
books=input(‘Enter the no of Books: ');
cost=books*25;
if books > 5
cost=(1 -20/100)*cost; % 20% discount
disp(cost)
end
The following program check if the input digital voltage signal
is positive or not.
V=input(‘Please Enter the Voltage: ')
if V < 5 % If voltage is less than 5 V
out_1 = 0 %Output is zero
elseif V == 5 % If voltage is equal to 5 V
out_1 = 0.5 % Output is o.5
else
out_1 = 1 % In other cases output is 1
end
Write a MATLAB program to input the values of x,y then
print 'y is greater than x‘ if y is greater and 'x is greater
than y‘ if x is greater and 'x =y‘ if they are equal.
clear all,clc;
x=input('enter the value x ');
y=input('enter the value y ');
if (x<y)
disp ('y is greater than x');
elseif (x>y)
disp ('x is greater than y');
else
disp ('x is =y');
end
 Program to find grade from the mark
s=input('Enter the Mark: '); % enter the mark
if s>= 90
disp ('Grade: A');
elseif s>=80
disp ('Grade: B');
elseif s>=70
disp ('Grade: C');
elseif s>=60
disp ('Grade: D');
else
disp ('Grade: F');
end
9
Shameer Koya
Ad

Recommended

MATLAB Programming - Loop Control Part 2
MATLAB Programming - Loop Control Part 2
Shameer Ahmed Koya
 
Loops in matlab
Loops in matlab
TUOS-Sam
 
Introduction to LaTeX - Workshop Day 1
Introduction to LaTeX - Workshop Day 1
Suddhasheel GHOSH, PhD
 
Matlab Functions
Matlab Functions
Umer Azeem
 
Matlab Script - Loop Control
Matlab Script - Loop Control
Shameer Ahmed Koya
 
Chapter 2: Relations
Chapter 2: Relations
nszakir
 
Poset in Relations(Discrete Mathematics)
Poset in Relations(Discrete Mathematics)
Rachana Pathak
 
Stressen's matrix multiplication
Stressen's matrix multiplication
Kumar
 
Gaussian Elimination Method
Gaussian Elimination Method
Andi Firdaus
 
Types of RELATIONS
Types of RELATIONS
Janak Singh saud
 
Matlab practical and lab session
Matlab practical and lab session
Dr. Krishna Mohbey
 
Introduction to Matlab
Introduction to Matlab
aman gupta
 
Angle between 2 lines
Angle between 2 lines
Simon Borgert
 
Introduction to matlab
Introduction to matlab
Tarun Gehlot
 
Inverse Matrix & Determinants
Inverse Matrix & Determinants
itutor
 
Predicates and Quantifiers
Predicates and Quantifiers
blaircomp2003
 
Basic matlab and matrix
Basic matlab and matrix
Saidur Rahman
 
MATLAB - Arrays and Matrices
MATLAB - Arrays and Matrices
Shameer Ahmed Koya
 
MATRICES
MATRICES
daferro
 
Matrices and determinants
Matrices and determinants
oscar
 
Bellman Ford's Algorithm
Bellman Ford's Algorithm
Tanmay Baranwal
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
Murshida ck
 
Introduction to Modular Arithmetic
Introduction to Modular Arithmetic
EFREN ARCHIDE
 
Rank, Nullity, and Fundamental Matrix Spaces.pptx
Rank, Nullity, and Fundamental Matrix Spaces.pptx
froilandoblon1
 
Dynamic programming
Dynamic programming
Shakil Ahmed
 
Algebra and trigonometry 4th edition stewart solutions manual
Algebra and trigonometry 4th edition stewart solutions manual
Harrison12
 
mathematical induction
mathematical induction
ankush_kumar
 
Matrix Operations
Matrix Operations
Ron Eick
 
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
 

More Related Content

What's hot (20)

Gaussian Elimination Method
Gaussian Elimination Method
Andi Firdaus
 
Types of RELATIONS
Types of RELATIONS
Janak Singh saud
 
Matlab practical and lab session
Matlab practical and lab session
Dr. Krishna Mohbey
 
Introduction to Matlab
Introduction to Matlab
aman gupta
 
Angle between 2 lines
Angle between 2 lines
Simon Borgert
 
Introduction to matlab
Introduction to matlab
Tarun Gehlot
 
Inverse Matrix & Determinants
Inverse Matrix & Determinants
itutor
 
Predicates and Quantifiers
Predicates and Quantifiers
blaircomp2003
 
Basic matlab and matrix
Basic matlab and matrix
Saidur Rahman
 
MATLAB - Arrays and Matrices
MATLAB - Arrays and Matrices
Shameer Ahmed Koya
 
MATRICES
MATRICES
daferro
 
Matrices and determinants
Matrices and determinants
oscar
 
Bellman Ford's Algorithm
Bellman Ford's Algorithm
Tanmay Baranwal
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
Murshida ck
 
Introduction to Modular Arithmetic
Introduction to Modular Arithmetic
EFREN ARCHIDE
 
Rank, Nullity, and Fundamental Matrix Spaces.pptx
Rank, Nullity, and Fundamental Matrix Spaces.pptx
froilandoblon1
 
Dynamic programming
Dynamic programming
Shakil Ahmed
 
Algebra and trigonometry 4th edition stewart solutions manual
Algebra and trigonometry 4th edition stewart solutions manual
Harrison12
 
mathematical induction
mathematical induction
ankush_kumar
 
Matrix Operations
Matrix Operations
Ron Eick
 
Gaussian Elimination Method
Gaussian Elimination Method
Andi Firdaus
 
Matlab practical and lab session
Matlab practical and lab session
Dr. Krishna Mohbey
 
Introduction to Matlab
Introduction to Matlab
aman gupta
 
Angle between 2 lines
Angle between 2 lines
Simon Borgert
 
Introduction to matlab
Introduction to matlab
Tarun Gehlot
 
Inverse Matrix & Determinants
Inverse Matrix & Determinants
itutor
 
Predicates and Quantifiers
Predicates and Quantifiers
blaircomp2003
 
Basic matlab and matrix
Basic matlab and matrix
Saidur Rahman
 
MATLAB - Arrays and Matrices
MATLAB - Arrays and Matrices
Shameer Ahmed Koya
 
MATRICES
MATRICES
daferro
 
Matrices and determinants
Matrices and determinants
oscar
 
Bellman Ford's Algorithm
Bellman Ford's Algorithm
Tanmay Baranwal
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
Murshida ck
 
Introduction to Modular Arithmetic
Introduction to Modular Arithmetic
EFREN ARCHIDE
 
Rank, Nullity, and Fundamental Matrix Spaces.pptx
Rank, Nullity, and Fundamental Matrix Spaces.pptx
froilandoblon1
 
Dynamic programming
Dynamic programming
Shakil Ahmed
 
Algebra and trigonometry 4th edition stewart solutions manual
Algebra and trigonometry 4th edition stewart solutions manual
Harrison12
 
mathematical induction
mathematical induction
ankush_kumar
 
Matrix Operations
Matrix Operations
Ron Eick
 

Viewers also liked (13)

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 programming tips 2 - Input and Output Commands
MATLAB programming tips 2 - Input and Output Commands
Shameer Ahmed Koya
 
User Defined Functions in MATLAB part 2
User Defined Functions in MATLAB part 2
Shameer Ahmed Koya
 
Matlab
Matlab
Muhammad Rehman Iqbal
 
Anonymous and Inline Functions in MATLAB
Anonymous and Inline Functions in MATLAB
Shameer Ahmed Koya
 
numericai matmatic matlab uygulamalar ali abdullah
numericai matmatic matlab uygulamalar ali abdullah
Ali Abdullah
 
Polynomials and Curve Fitting in MATLAB
Polynomials and Curve Fitting in MATLAB
Shameer Ahmed Koya
 
Differential equation & laplace transformation with matlab
Differential equation & laplace transformation with matlab
Ravi Jindal
 
MATLAB : Numerical Differention and Integration
MATLAB : Numerical Differention and Integration
Ainul Islam
 
Matlab Introduction
Matlab Introduction
Daniel Moore
 
Interpolation and extrapolation
Interpolation and extrapolation
Aswin Pv
 
FDM Numerical solution of Laplace Equation using MATLAB
FDM Numerical solution of Laplace Equation using MATLAB
Aya Zaki
 
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 programming tips 2 - Input and Output Commands
MATLAB programming tips 2 - Input and Output Commands
Shameer Ahmed Koya
 
User Defined Functions in MATLAB part 2
User Defined Functions in MATLAB part 2
Shameer Ahmed Koya
 
Anonymous and Inline Functions in MATLAB
Anonymous and Inline Functions in MATLAB
Shameer Ahmed Koya
 
numericai matmatic matlab uygulamalar ali abdullah
numericai matmatic matlab uygulamalar ali abdullah
Ali Abdullah
 
Polynomials and Curve Fitting in MATLAB
Polynomials and Curve Fitting in MATLAB
Shameer Ahmed Koya
 
Differential equation & laplace transformation with matlab
Differential equation & laplace transformation with matlab
Ravi Jindal
 
MATLAB : Numerical Differention and Integration
MATLAB : Numerical Differention and Integration
Ainul Islam
 
Matlab Introduction
Matlab Introduction
Daniel Moore
 
Interpolation and extrapolation
Interpolation and extrapolation
Aswin Pv
 
FDM Numerical solution of Laplace Equation using MATLAB
FDM Numerical solution of Laplace Equation using MATLAB
Aya Zaki
 
Ad

Similar to Conditional Control in MATLAB Scripts (20)

Chapter 3 - Programming in Matlab. aaaapptx
Chapter 3 - Programming in Matlab. aaaapptx
danartalabani
 
Chap2programing.pptxdxnDSnfkezjnfqjdsckjqds
Chap2programing.pptxdxnDSnfkezjnfqjdsckjqds
yassinebrh31
 
Matlab m files and scripts
Matlab m files and scripts
Ameen San
 
04 a ch03_programacion
04 a ch03_programacion
universidad del valle colombia
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
Kurmendra Singh
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
amanabr
 
ET DAH SI HAN HAN ADIKNYA SI WIDIANTORO RIBUT MULU SAMA ABANG WIDI
ET DAH SI HAN HAN ADIKNYA SI WIDIANTORO RIBUT MULU SAMA ABANG WIDI
IrlanMalik
 
7_Programming in MATLAB For Enginee.pptx
7_Programming in MATLAB For Enginee.pptx
SungaleliYuen
 
B61301007 matlab documentation
B61301007 matlab documentation
Manchireddy Reddy
 
Matlab Workshop Presentation
Matlab Workshop Presentation
Jairo Maldonado-Contreras
 
MATLAB_PROGRAMMING_BASICTOADVANCEDSCRIPT
MATLAB_PROGRAMMING_BASICTOADVANCEDSCRIPT
PixelAswath
 
1. Ch_1 SL_1_Intro to Matlab.pptx
1. Ch_1 SL_1_Intro to Matlab.pptx
MOHAMMAD SAYDUL ALAM
 
NUMERICAL METHODS WITH MATLAB PROGRAMMING
NUMERICAL METHODS WITH MATLAB PROGRAMMING
DHARANI A
 
Matlab tutorial 3
Matlab tutorial 3
Norhan Abdalla
 
Csci101 lect02 selection_andlooping
Csci101 lect02 selection_andlooping
Elsayed Hemayed
 
Mbd dd
Mbd dd
Aditya Choudhury
 
Intro to matlab
Intro to matlab
Norhan Mohamed
 
Summer training matlab
Summer training matlab
Arshit Rai
 
Matlab Basic Tutorial
Matlab Basic Tutorial
Muhammad Rizwan
 
3.pdf
3.pdf
DEVENDRA PRATAP SINGH
 
Chapter 3 - Programming in Matlab. aaaapptx
Chapter 3 - Programming in Matlab. aaaapptx
danartalabani
 
Chap2programing.pptxdxnDSnfkezjnfqjdsckjqds
Chap2programing.pptxdxnDSnfkezjnfqjdsckjqds
yassinebrh31
 
Matlab m files and scripts
Matlab m files and scripts
Ameen San
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
Kurmendra Singh
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
amanabr
 
ET DAH SI HAN HAN ADIKNYA SI WIDIANTORO RIBUT MULU SAMA ABANG WIDI
ET DAH SI HAN HAN ADIKNYA SI WIDIANTORO RIBUT MULU SAMA ABANG WIDI
IrlanMalik
 
7_Programming in MATLAB For Enginee.pptx
7_Programming in MATLAB For Enginee.pptx
SungaleliYuen
 
B61301007 matlab documentation
B61301007 matlab documentation
Manchireddy Reddy
 
MATLAB_PROGRAMMING_BASICTOADVANCEDSCRIPT
MATLAB_PROGRAMMING_BASICTOADVANCEDSCRIPT
PixelAswath
 
1. Ch_1 SL_1_Intro to Matlab.pptx
1. Ch_1 SL_1_Intro to Matlab.pptx
MOHAMMAD SAYDUL ALAM
 
NUMERICAL METHODS WITH MATLAB PROGRAMMING
NUMERICAL METHODS WITH MATLAB PROGRAMMING
DHARANI A
 
Matlab tutorial 3
Matlab tutorial 3
Norhan Abdalla
 
Csci101 lect02 selection_andlooping
Csci101 lect02 selection_andlooping
Elsayed Hemayed
 
Summer training matlab
Summer training matlab
Arshit Rai
 
Matlab Basic Tutorial
Matlab Basic Tutorial
Muhammad Rizwan
 
Ad

Recently uploaded (20)

English 3 Quarter 1_LEwithLAS_Week 1.pdf
English 3 Quarter 1_LEwithLAS_Week 1.pdf
DeAsisAlyanajaneH
 
Vitamin and Nutritional Deficiencies.pptx
Vitamin and Nutritional Deficiencies.pptx
Vishal Chanalia
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
Aprendendo Arquitetura Framework Salesforce - Dia 02
Aprendendo Arquitetura Framework Salesforce - Dia 02
Mauricio Alexandre Silva
 
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
sumadsadjelly121997
 
Gladiolous Cultivation practices by AKL.pdf
Gladiolous Cultivation practices by AKL.pdf
kushallamichhame
 
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
 
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
 
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
ErlizaRosete
 
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
jutaydeonne
 
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
 
CRYPTO TRADING COURSE BY FINANCEWORLD.IO
CRYPTO TRADING COURSE BY FINANCEWORLD.IO
AndrewBorisenko3
 
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
 
Peer Teaching Observations During School Internship
Peer Teaching Observations During School Internship
AjayaMohanty7
 
Pests of Maize: An comprehensive overview.pptx
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
 
How payment terms are configured in Odoo 18
How payment terms are configured in Odoo 18
Celine George
 
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
KaryanaTantri21
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
English 3 Quarter 1_LEwithLAS_Week 1.pdf
English 3 Quarter 1_LEwithLAS_Week 1.pdf
DeAsisAlyanajaneH
 
Vitamin and Nutritional Deficiencies.pptx
Vitamin and Nutritional Deficiencies.pptx
Vishal Chanalia
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
Aprendendo Arquitetura Framework Salesforce - Dia 02
Aprendendo Arquitetura Framework Salesforce - Dia 02
Mauricio Alexandre Silva
 
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
sumadsadjelly121997
 
Gladiolous Cultivation practices by AKL.pdf
Gladiolous Cultivation practices by AKL.pdf
kushallamichhame
 
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
 
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
 
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
ErlizaRosete
 
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
jutaydeonne
 
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
 
CRYPTO TRADING COURSE BY FINANCEWORLD.IO
CRYPTO TRADING COURSE BY FINANCEWORLD.IO
AndrewBorisenko3
 
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
 
Peer Teaching Observations During School Internship
Peer Teaching Observations During School Internship
AjayaMohanty7
 
Pests of Maize: An comprehensive overview.pptx
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
 
How payment terms are configured in Odoo 18
How payment terms are configured in Odoo 18
Celine George
 
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
KaryanaTantri21
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 

Conditional Control in MATLAB Scripts

  • 2.  Conditional control – if, else, switch  Loop control – for, while, continue, break  Program termination – return 2 if, else, and elseif for while
  • 3. if test statement statements elseif test statement statements else statements end 3 if I == J A(I,J) = 2; elseif abs(I-J) == 1 A(I,J) = -1; else A(I,J) = 0; end • Conditional statements are commands that allows MATLAB to decide whether or not to execute some code that follows the statement • Conditional statements use relational operators like ==,~=,>,< (Note that are all scalar tests)
  • 4.  If the conditional expression is true, MATLAB runs the lines of code that are between the line with if and the line with end.  If the conditional expression is false, MATLAB skips the code between if and the line with else and runs the code up to end.
  • 5. height=input(‘Plz enter the height:‘) if height>170 disp('tall') elseif height<150 disp('small') else disp('average') end
  • 6. A program to make a discount of 20% if the no. of books are greater than 5 clc; books=input(‘Enter the no of Books: '); cost=books*25; if books > 5 cost=(1 -20/100)*cost; % 20% discount disp(cost) end
  • 7. The following program check if the input digital voltage signal is positive or not. V=input(‘Please Enter the Voltage: ') if V < 5 % If voltage is less than 5 V out_1 = 0 %Output is zero elseif V == 5 % If voltage is equal to 5 V out_1 = 0.5 % Output is o.5 else out_1 = 1 % In other cases output is 1 end
  • 8. Write a MATLAB program to input the values of x,y then print 'y is greater than x‘ if y is greater and 'x is greater than y‘ if x is greater and 'x =y‘ if they are equal. clear all,clc; x=input('enter the value x '); y=input('enter the value y '); if (x<y) disp ('y is greater than x'); elseif (x>y) disp ('x is greater than y'); else disp ('x is =y'); end
  • 9.  Program to find grade from the mark s=input('Enter the Mark: '); % enter the mark if s>= 90 disp ('Grade: A'); elseif s>=80 disp ('Grade: B'); elseif s>=70 disp ('Grade: C'); elseif s>=60 disp ('Grade: D'); else disp ('Grade: F'); end 9