Question
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 c
0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE:

#include <iostream>

using namespace std;

// function

void findEvenOrOdd(int num){

  // check if even or not

  if(num%2==0)

    cout<<num<<" is an EVEN number"<<endl;

  else

    cout<<num<<" is an ODD number"<<endl;

}

// main method

int main() {

findEvenOrOdd(6);

findEvenOrOdd(11);

}

main.cpp 1 #include <iostream> 2 using namespace std; 3 4 // function 5 void findEvenOrodd(int num) { 6 // check if even or n

OUTPUT:

6 is an EVEN number 11 is an ODD number

Please upvote if you like my answer and comment below if you have any queries or need any further explanation.

Add a comment
Know the answer?
Add Answer to:
This exercise is also from C++ How do I even figure this out? please help me...
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
  • 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...

  • In this exercise, you will create a script called if_then_else.sh that uses an IF THEN ELSE...

    In this exercise, you will create a script called if_then_else.sh that uses an IF THEN ELSE statement. The if_then_else.sh script will Use one command line argument, which will be a number between 1 and 10 Assign the value of the first argument to a local variable called NUM. HINT: Look at line 5 in the example screenshot for arguments.sh Use one IF THEN ELSE statement to compare the value of NUM If the number is less than 5, display the...

  • this is written in c++ This code needs to work with any input to have the...

    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, 11:59 PM 4.4 Lab 21: Number Divisible by 4 and/or 5 Write a program that reads in an integer number. It should then determine if...

  • This is used as C++ How do I even figure this out at all? Please help...

    This is used as C++ How do I even figure this out at all? Please help me solve this tough question Question 30 10 pts (SHORT ANSWER) Write three separate if blocks to check the following THREE conditions (number your answers): 1. If the number variable testScore is outside the range of 0 through 100 (excluding both those scores), print the message: "INVALID: OUTSIDE RANGE 0-100" 2. If the number variable bonusPoints is inside the range 1 through 10 (including...

  • c++ please (1) Write a program that prompts the user to enter an integer value N...

    c++ please (1) Write a program that prompts the user to enter an integer value N which will rpresent the parameter to be sent to a function. Use the format below. Then write a function named CubicRoot The function will receive the parameter N and return'its cubic value. In the main program print the message: (30 Points) Enter an integer N: [. ..1 The cubic root of I.. ] is 2 update the code om part and write another function...

  • I need help with this exercise. Thank you for your help Language is C++ 6. Write...

    I need help with this exercise. Thank you for your help Language is C++ 6. Write a program that prompts the user to input a positive integer. It should then output a message indicating whether the number is a prime number. (Note: An even number is prime if it is 2. An odd inte- ger is prime if it is not divisible by any odd integer less than or equal to the square root of the number.)

  • I want to know how to do this assignment!!! Help me please~ The first part of...

    I want to know how to do this assignment!!! Help me please~ The first part of your program should do the following: • Ask the user type of test they took. o (ACT or SAT) • If they said ACT then ask them their score o If their ACT score was between 0 and 7 say "Needs Work" o If their ACT score was between 10 and 20 say "Acceptable" o If they ACT score was above 20 say "Above...

  • This is a matlab HW that I need the code for, if someone could help me figure this out it would b...

    This is a matlab HW that I need the code for, if someone could help me figure this out it would be appreciated. The value of t can be estimated from the following equation: in your script file, estimate the value of π for any number of terms. You must ask the user for the desired number of terms and calculate the absolute error/difference between your calculation and the built-in MATLAB value ofpi. Display your results with the following message...

  • MATLAB help! I have some MATLAB Assignment to do, the proffesor requires all the small parts...

    MATLAB help! I have some MATLAB Assignment to do, the proffesor requires all the small parts in order to get full credit. Help me out, thank you f LAB SECTION NAME HW6P3 (30 points) following are infinite series representations of the function, un pra i a script file HW6P3 that determines the value of the function from the sum of the series for a given value of x. The program (1 pt) must prompt the user to enter a value...

  • hi, please help in c++. I dont understand how to do this, and a lot of...

    hi, please help in c++. I dont understand how to do this, and a lot of the ways on the internet is confusing me, i am a beginner. with all steps and explantions, will rate! Write a program that determines the frequency of each char in an input file. Your program should . read in an unknown number of chars from an input file named input.txt, • using a function written by you, determine the frequency of occurrence of each...

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