Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a MATLAB code that takes a single 3-digit integer (X) from the user as input and perform the following conditions: a)Check the given integer

image text in transcribed
image text in transcribed
Write a MATLAB code that takes a single 3-digit integer (X) from the user as input and perform the following conditions: a)Check the given integer is divisible by 2 and 5 b)Check the given integer is divisible by 2 and not by 5 c)Check the given integer is divisible by 5 and not by 2 d)Check the given integer is neither divisible by 5 nor by 2 Hint 1: rem(X.3) and rem(X,5) or mod (X.3) and mod (X,5) Hint 2: The input should be strictly a 3-digit number like (135). Check that the entered number is a valid 3-digit number if it is not valid print "NOT VALID NUMBER". You output should be the same as below: Please enter a three-digit number: 1 NOT VALID NUMBER Please Enter a three-digit number: 12 NOT VALID NUMBER Please Enter a three-digit number: 1234 NOT VALID NUMBER Please Enter a three-digit number: 100 The number 100 is divisible by 2 and 5 Please Enter a three-digit number: 214 The number 214 is divisible by 2 and not 5 Hint 1: rem(X.3) and rem(X,5) or mod (X.3) and mod (X,5) Hint 2: The input should be strictly a 3-digit number like (135). Check that the entered number is a valid 3-digit number, if it is not valid print "NOT VALID NUMBER". You output should be the same as below: Please enter a three-digit number: 1 NOT VALID NUMBER Please enter a three-digit number: 12 NOT VALID NUMBER Please enter a three-digit number: 1234 NOT VALID NUMBER Please enter a three-digit number: 100 The number 100 is divisible by 2 and 5 Please Enter a three-digit number: 214 The number 214 is divisible by 2 and not 5 Please enter a three-digit number: 215 The number 215 is divisible by 5 and not 2 Please enter a three-digit number: 123 The number 123 is neither divisible by 2 nor 5 Click Sand Co

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

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions