Write a MATLAB program for find Largest number in three number using if statement

Code:

clear;

clc;
a=input('Enter the first number \n');
b=input('Enter the second number \n');
c=input('Enter the third number \n');
if(a>=b && a>=c)
fprintf('Largest number = %d\n', a);
elseif(b>=a && b>=c)
fprintf('Largest number = %d\n', b);
elseif(c>=a && c>=b)
fprintf('Largest number = %d\n', c);
end


Output:

No comments

Powered by Blogger.