Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ WORK: Write a program to read one 3-digit integer number (from 100 to 999) from the console. If you consider each digit of the

C++ WORK:

Write a program to read one 3-digit integer number (from 100 to 999) from the console. If you consider each digit of the number represented by the letters A, B, and C; we can label the number as ABC.

Your program should:

Make sure the user enters the appropriate type of number

And fits in the right range

Strip each digit A, B, and C from the number

Example: User enters 452: A should be 4; B should be 5; C should be 2;

Hint#1: whats the integer division of 452/100?

Hint#2: the modulo operator (%) is also quite handy!

Form the numbers ABC, BCA, and CAB and store them to variables named accordingly.

From example above: ABC should be 452; BCA should be 524; CAB should be 254;

Find the remainders of each of the numbers ABC, BCA, and CAB when divided by 11. Store these remainders to variables named X, Y, and Z respectively.

Find and store the sums X+Y, Y+Z, and Z+X. For discussion sake, well refer to each of these sums as P, R, and Q respectively.

Your program should provide a formatted printout of all the computed numbers and sums. Your program should display a welcome message and prompt the user to enter the required numeric input. Your program should also prevent the user from entering anything but a 3-digit number, and continue to ask the user for an appropriate input until they enter one. image text in transcribed

Program Description Write a program to read one 3-digit integer number (from 100 to 999) from the console. If you consider each digit of the number represented by the letters A, B, and C; we can label the number as ABO. Your program should: Make sure the user enters the appropriate type of number o And fits in the right range Strip each digit A, B, and C from the number Example: User enters 452: A should be 4; B should be 5; C should be 2; Hint#1: what's the integer division of 452/10O? Hint#2: the modulo operator (%) is also quite handy! o o Form the numbers ABC, BCA, and CAB and store them to variables named accordingly. o From example above: ABC should be 452; BCA should be 524; CAB should be 254; Find the remainders of each of the numbers ABC, BCA, and CAB when divided by 11. Store these remainders to variables named X, Y, and Z respectively. Find and store the sums X+Y, Y+Z, and Z+X. For discussion sake, we'll refer to each of these sums as P, R, and Q respectively. Your program should provide a formatted printout of all the computed numbers and sums. Your program should display a welcome message and prompt the user to enter the required numeric input. Your program should also prevent the user from entering anything but a 3-digit number, and continue to ask the user for an appropriate input until they enter one

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

Students also viewed these Databases questions

Question

7. Interrupt others when they are speaking?

Answered: 1 week ago