Question: MATLAB need help Write a script called old Macdonald that prints the lyrics to the nursery rhyme Old MacDonald Had a Farm. The program should
MATLAB need help
Write a script called old Macdonald that prints the lyrics to the nursery rhyme "Old MacDonald Had a Farm". The program should input the type of animal and the sound it makes. For example, if the input is animal= 'cow, and sound = 'moo' , the following will be printed. Old MacDonald had a farm, E-I-E-I-O! And on that farm he had a cow, E-I-E-I-O! With a moo-moo here, and moo-moo there. Here a moo, there a moo, everywhere a moo-moo. old MacDonald had a farm, E-I-E-I-o! Use the fprintffunction to print the lines of the lyrics. As an example, if fprintf is to print sound 4 times, the locations of the word assigned to the variable sound will need to use four %s to preserve the space where you want the value of the variable sound to be placed in the line of text. You also need to have the variable name sound listed 4 times after the sentence For example, if I wanted to print the names of my 3 sons, I would use fprintf ('The names of my 3 sons are %s, %s, and %s. ", son, son2,son3) where son1-Sam, son2-Jim, and so n3c,Dan, No comments, no checking of input required for this problem Submit your m file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
