Ask Question
12 September, 13:47

Create a program in Matlab that prints the numbers from 1-100.

For multiples of 3 print "Yee" for multiples of 5 print "Haw" for numbers which are multiples of 3 and 5 print "Yee-Haw".

+1
Answers (1)
  1. 12 September, 15:55
    0
    numbers = 1:1:100;

    for num=numbers

    remainder3 = rem (num, 3);

    remainder5 = rem (num, 5);

    if remainder3==0

    disp ("Yee")

    else

    if remainder3 = = 0 && remainder5 = = 0

    disp ("Yee-Haw")

    else

    if remainder5==0

    disp ("Haw")

    else

    disp ("Not a multiple of 5 or 4")

    end

    end

    end

    end

    Explanation:

    Initialize the numbers variable from 1 to 100. Loop through the all the numbers and find their remainders. Check if a number is multiple of 5, 3 or both and display the message accordingly.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Create a program in Matlab that prints the numbers from 1-100. For multiples of 3 print "Yee" for multiples of 5 print "Haw" for numbers ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers