Question: 2. Write a C program that prompts the user to enter a number. If the number is an even number other than a multiple


2. Write a C program that prompts the user to enter a 

2. Write a C program that prompts the user to enter a number. If the number is an even number other than a multiple of 8 (8, 16, 24, 32 ...), the program will calculate the square of the number and print it on the screen, and ask for another number. If the number is odd, other than a multiple of 7 (7, 14, 21 ...), the program will calculate the cube of the number, print it on the screen, and then ask for another number. The program will continue until the user enters the number 0 (zero). You should use for-loop structure with "continue" and "break" statements. Hints: The program should use the statement "continue", whenever the user input is a multiple of 7 or 8, in order to skip to the next iteration of the loop. The program should use the statement "break" when the user input is equal to 0 (zero).

Step by Step Solution

3.38 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

PROBLEM STATEMENT 2 Write a C program that prompts the user to enter a number If the number is an ev... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!