THIS IS A MATLAB SCRIPT
Consider your name as representing numbers of the alphabet in reverse (A = 26, B=25, etc). Write a Matlab script to answer the following:
1. Sum of first name + Last name
2. Ratio of first name / Last name
3. Sum of first name raise to power of sum of last name
Keanu Reeves
f = 'Keanu'
s1=0%tostore sum
for j=1 :length(f)
n = double(f(j))
if 65<=n && n<=90
n=n-65
elseif 97<=n && n<=122
n=n-97
end
n=26-n
s1=s1+n%finding sum
end
s ='Reeves'
s2=0%tostore sum
for j=1 :length(s)
n = double(s(j))
if 65<=n && n<=90
n=n-65
elseif 97<=n && n<=122
n=n-97
end
n=26-n
s2=s2+n%finding sum
end
%1
fprintf('Sum of first name + last name :%d\n',s1+s2)
%2
fprintf('Ratio of first name / last name :%f\n',s1/s2)
%3
fprintf('Sum of first name raise to power of sum of last name
:%d\n',s1^s2)
Get Answers For Free
Most questions answered within 1 hours.