Write a program that allows the user to enter a number between 1 and 1000.  If the number is invalid, provide an error message and allow the user to try again until he enters a valid value.  Once you have a valid number, use it to determine and print the following information: *Note that in the list of factor pairs, you should not include duplicates.   program in python   Number squared Number cubed Number Type: Even composite number Odd or Even   Prime (Exactly 2 factors) or Composite (More than 2 factors) Whether the number is a perfect square: No (6 does not have an integer square root like 4 or 9) Square Root: (Print this line only if the number is perfect square) List of factors that exclude duplicates and are printed horizontally on a single line Factors: (1, 12) (2, 6) (3, 4) (4, 3) (6, 2) (12, 1) should not be included

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 14PE
icon
Related questions
Question
100%

Write a program that allows the user to enter a number between 1 and 1000.  If the number is invalid, provide an error message and allow the user to try again until he enters a valid value. 

Once you have a valid number, use it to determine and print the following information:

*Note that in the list of factor pairs, you should not include duplicates.

 

program in python

 

  • Number squared
  • Number cubed
  • Number Type: Even composite number
    Odd or Even   Prime (Exactly 2 factors) or Composite (More than 2 factors)
  • Whether the number is a perfect square: No (6 does not have an integer square root like 4 or 9)
  • Square Root: (Print this line only if the number is perfect square)
  • List of factors that exclude duplicates and are printed horizontally on a single line
    Factors: (1, 12) (2, 6) (3, 4)
    (4, 3) (6, 2) (12, 1) should not be included

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Program on Numbers
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning