Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
141 views

MATLAB Codes

This document contains 4 short programs. The first program calculates the volume of a cone given its height and radius. The second program performs basic math operations (addition, subtraction, multiplication, division) on two user-input numbers. The third program calculates a complex mathematical expression involving logarithmic, exponential, and power functions of a single user-input variable. The fourth program is unlabeled.

Uploaded by

prettyswag
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
141 views

MATLAB Codes

This document contains 4 short programs. The first program calculates the volume of a cone given its height and radius. The second program performs basic math operations (addition, subtraction, multiplication, division) on two user-input numbers. The third program calculates a complex mathematical expression involving logarithmic, exponential, and power functions of a single user-input variable. The fourth program is unlabeled.

Uploaded by

prettyswag
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

%program by:

%program number 1
x=input('Input Height = ');
r=input('Input Radius = ');
y = 1/3*3.1416*x*r;
fprintf('The volume of the cone is %0.02f units cube', y)
%program number 2
q =input('\n\n\nFirst Number = ');
w =input('Second Number = ');
s =
d =
m =
div

q+w;
q-w;
q*w;
= q/w;

fprintf('\nTwo numbers are %d and %d. \nSum is %0.02f \nDifference is %0.02f \nP
roduct is %0.02f \nQuotient is %0.02f', q,w,s,d,m,div)
%program number 3
k = input('\n\n Input X = ');
h = ((log((3)*k))-(exp((2)*k)))/((log10((k)-3))+((k)*(k)));
fprintf(' The answer is %0.02f', h)
%program number 4

You might also like