Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2018 Dublin Ireland September 10 14 2018 Proceedings Part 1 Lnai 11051

Authors: Michele Berlingerio ,Francesco Bonchi ,Thomas Gartner ,Neil Hurley ,Georgiana Ifrim

1st Edition

3030109240, 978-3030109240

More Books

Students also viewed these Databases questions

Question

Find the derivative. f(x) 8 3 4 mix X O 4 x32 4 x32 3 -4x - x2

Answered: 1 week ago

Question

2. What is the business value of security and control?

Answered: 1 week ago