Question: Problem 3. Write a Matlab program that asks the user to input an integer. Print Even if the number is even. Prints Odd if the

 Problem 3. Write a Matlab program that asks the user to

Problem 3. Write a Matlab program that asks the user to input an integer. Print "Even" if the number is even. Prints "Odd" if the number is odd. Use the rem function to test for an even or odd number. The rem(X,Y) function returns the remainder of dividing X by Y. If rem(X,2)=0, X is even. Use the if-else statement in your solution. The following is a sample of an output from two separate executions of the program: Type an integer: 2 Even Type an integer: 3 Odd Problem 4. Modify your solution to the previous problem by checking whether the number entered by the user is an integer. One way to do this is to test if the rounded input is equal to the input. If it is, then the input is an integer. The round function returns the rounded value of the input argument. If the number is not an integer, print "Not an integer". Use an if-elseif statement in your solution. The following is a sample of the output from two separate executions of the program: Type an integer; 2.5 Not an integer Type an integer: 2 Even

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!