Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that asks the user to enter any integer. The program first takes the absolute value of the number and then outputs whether

Write a program that asks the user to enter any integer. The program first takes the absolute value of the number and then outputs whether it is odd or even. Then, it does the following depending on the range: - If the absolute value of the number is less than 10, output whether it is divisible by 3, 4, or 5. - If the absolute value of the number is greater than or equal to 10 and less than 50, output all of its factors. - If the absolute value of the number is greater than or equal to 50, output all of its even factors. ............................................................................................................................................................................................................................................................................................ Subject: EGR 126 ( Computer programming for engineers ) C++ Help please. Thankyou

.......................................................................................................................

#include

using namespace std;

int main() { //variable declaration int num; //get input from the user cout<<"Enter an integer: "; cin>>num; //calculate abosolute value num = abs(num); //check if input number is even or odd if(num%2==0) cout<<"This is an even number."; else cout<<"This is an odd number."; //check if input number is divisible by 3, 4 or 5. if(num<10) { if(num%3==0) cout<

return 0; }

............................................................................................................................................................................

If this is the write answer, can you please explain in written words from a to z how we came up to this conclusion. Plus, after we hit run, we input the integers as 50 and 45 only so we can get the out put. my question is why only these two number? why not adding 9 as well since it asks us If the absolute value of the number is less than 10, output whether it is divisible by 3, 4, or 5?

Sorry about the confusion, I'm just trying to understand whats going on. Thankyou for your efforts.

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

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions