Question

this is written in c++

This code needs to work with any input to have the output with different numbers that are entered in.

Please help me I need help with this problem.

Thanks


$ Section 4.4 is a part of assignment Lab21: Number Divisible by 4 and/or 5 Requirements: zylab Entire class due: 03/01/2020,

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;

    if (n % 4 == 0 && n % 5 == 0) {
        cout << n << " is divisible by both 4 and 5." << endl;
    } else if (n % 4 == 0 || n % 5 == 0) {
        cout << n << " is divisible by either 4 or 5, but not both." << endl;
    } else {
        cout << n << " is divisible by neither 4 nor 5." << endl;
    }
    return 0;
}
Add a comment
Know the answer?
Add Answer to:
this is written in c++ This code needs to work with any input to have the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This exercise is also from C++ How do I even figure this out? please help me...

    This exercise is also from C++ How do I even figure this out? please help me solve so I can get the answer correctly! Question 28 10 pts (SHORT ANSWER) Define a function named findEvenOrOdd that has 1 int parameter: num. When the function is called, it should use an if/else statement -OR- conditional expression to determine whether the variable num is an even or odd number and display appropriate message as follows: • If the value in num is...

  • Code in C An integer is divisible by 9 if the sum of its digits is...

    Code in C An integer is divisible by 9 if the sum of its digits is divisibleExample output: by 9. Develop a program which will call UDF: int get input(); to prompt the user for an integer and return this user input to main() Call UDF: Enter an integer: 5463 3 4 5 5463 is divisible by 9 void display int val); to display each digit of the integer starting with the rightmost digit. Your program should also determine whether...

  • python programming X Canvas 4 → XCO Question 26 10 pts (SHORT ANSWER) Define a function...

    python programming X Canvas 4 → XCO Question 26 10 pts (SHORT ANSWER) Define a function named find_even_odd that has 1 parameter: num. When the function is called, it should use an if/else statement to determine whether the variable num is an even or odd number and display appropriate message as follows: • If the value in num is an even number, the progr will output the message: "XX is an EVEN number", where XX is the value in the...

  • c++ assignment about command line

    Write a program that uses command-line processing to get a number of integers and then print them out in descending order. The number of input integers is limited to 5 ; otherwise, an error message should be displayed. A sample output is shown below:I still cant figure out how to do the c++ command line assignment on visual studios so help me with the full coding asap.Keep in mind the program should be a beginner's level and dont make it...

  • PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program tha...

    PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program that reads a values for hour and minute from the input test file timeData.txt . The data read for valid hour and valid minute entries. Assume you are working with a 24 hour time format. Your program should use functions called validateHour and validateMinutes. Below is a sample of the format to use for your output file  timeValidation.txt :   ...

  • this should be a code for C++ the source code file so the program will operate...

    this should be a code for C++ the source code file so the program will operate as described below. These are the software requirements for the project. When the program runs, it shall display the text as shown on lines 1-11 in the example below. Next, it shall display a prompt message asking the user to enter his or her yearly salary. Next, it shall shall read the user's salary from the keyboard (in the example below, user input is...

  • C++ requirements The store number must be of type unsigned int. The sales value must be...

    C++ requirements The store number must be of type unsigned int. The sales value must be of of type long long int. Your program must properly check for end of file. See the section Reading in files below and also see your Gaddis text book for details on reading in file and checking for end of file. Your program must properly open and close all files. Failure to follow the C++ requirements could reduce the points received from passing the...

  • Has to be written in C++ Write a program that asks the user to enter the...

    Has to be written in C++ Write a program that asks the user to enter the month (1-12) and the year (0-2019). Validate the input and print an error and stop the program if an invalid month or year was entered. The program should then display the number of days in that month. Use the following criteria to identify leap years: Determine whether the year is divisible by 100. If it is, then it is a leap year if and...

  • DATA PROGRAMMING: PYTHON Be sure to use sys.argv NOT input. Write a program and create a...

    DATA PROGRAMMING: PYTHON Be sure to use sys.argv NOT input. Write a program and create a function called inch2cm that takes one number in inches as a parameter, converts it to the centimeters and prints the result. The program output is shown below. Input: 14 Output: 14 inches = 35.56 centimeter Write a program and create the following functions: shapes(): takes the shape name and a number as parameters, and calls the proper function to calculate the area. areaCircle(): take...

  • Use only if else nested if else only otherwise your answer won't be entertained. Problem 1(b):...

    Use only if else nested if else only otherwise your answer won't be entertained. Problem 1(b): Write a program that gives remainder without using modulus operator and loops. The first number entered will be dividend and second number entered will be divisor. Sample input: 15 6 Sample output: Remainder is 3 In a right triangle, the square of the length of one side is equal to the sum of the squares of the length of the other two sides. Write...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT