Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a script that ask the user to input an integer n. The script should print

ID: 3876338 • Letter: W

Question

Write a script that ask the user to input an integer n. The script should print the factorials 1! up to n!, as shown in the example below. Example: Enter a numbers 1 = 1 1*2 = 2 1*2*3 = 6 1*2*3*4 = 24 Make sure you test your script with multiple input values. Write a function called shiftedWord which takes a string S and a number "n" as a input and returns the original string shifted n places to the right as shown in the examples below. shiftedWord('today', 3) = 'dayto' shiftedWord('123456789', 4) = '678912345' shiftedword('1234', 4) = '1234' Then write a driver that asks the user to type a word and a number calls shiftedWord, and prints a message with the result. The driver should ask for another input string and a number, and stop when the user enters a negative number.

Explanation / Answer

1)
code:
num = input('Give the number to calculate factorial');
fact = 1;
for i = 1:num
    for j = 1:i-1
        disp(j);
        disp('*');
    end
    disp(i);
    fact = fact*i;
    disp('=');
    disp(fact);
end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote