iven an integer variable n: rite a few lines of code to: 2 if n is a multiple of 2 and not a multiple of 4 or 8 4 if n is a multiple of 2, 4 and not a multiple of 8 8 if n is a multiple of 8, 4 and 2 kample Output (if n is 16) kample Output (if n is 12) kample Output (if n is 6)

CMPTR
3rd Edition
ISBN:9781337681872
Author:PINARD
Publisher:PINARD
Chapter14: Working With Formulas And Functions
Section: Chapter Questions
Problem 8QY
icon
Related questions
Question
100%

c++ programming

Given an integer variable n:
Write a few lines of code to:
1) 2 if n is a multiple of 2 and not a multiple of 4 or 8
2) 4 if n is a multiple of 2, 4 and not a multiple of 8
3) 8 if n is a multiple of 8, 4 and 2
Example Output (if n is 16)
8
Example Output (if n is 12)
4
Example Output (if n is 6)
Transcribed Image Text:Given an integer variable n: Write a few lines of code to: 1) 2 if n is a multiple of 2 and not a multiple of 4 or 8 2) 4 if n is a multiple of 2, 4 and not a multiple of 8 3) 8 if n is a multiple of 8, 4 and 2 Example Output (if n is 16) 8 Example Output (if n is 12) 4 Example Output (if n is 6)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage