Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in C++ that will take in a whole number then using the conditional operator determine if the number is odd or even.

Write a program in C++ that will take in a whole number then using the conditional operator determine if the number is odd or even. The conditional operator should assign a value of "Odd" or "Even" to a string variable to be displayed to the screen.

Required:

No cin or cout statments within the conditional operator

Only one assignment operator is allowed as part of the conditional operator.

The conditional operator must assign a value of either "Odd" or "Even" to a variable to be displayed.

Processing:

Input - A whole number.

Process - Using the condtional operator determine if the number is odd or even

Output - A string value that says "Odd" or "Even" dependining upon the processing.

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

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions