filmov
tv
C Numbers 28: Check whether a given number is a perfect cube [C Programming]

Показать описание
Write a program in C to check whether a given number is a perfect cube or not.
Expected Output :
Input a number : 125
The number is a perfect Cube of 5
==============================================
What is a Perfect Cube?
If the prime factors of a number are grouped in triples of equal factors, then that number is called a perfect cube.
Examples:
1. Resolving 250 as the product of prime factors
250 = 2 x 5x5x5
Since 2 does not exist in product of triples.
Therefore, 250 is not a perfect cube.
2. Resolving 5832 as the product of prime factors
5832 = 2x2x2 x 3x3x3 x 3x3x3
Since, they are grouped in triples.
Therefore, 5832 is a perfect cube
3. Resolving 1944 as the product of prime factors
1944 = 2x2x2 x 3x3x3 x 3x3
In order to make 1944 a perfect cube, it must be multiplied by 3.
=================================================
Expected Output :
Input a number : 125
The number is a perfect Cube of 5
==============================================
What is a Perfect Cube?
If the prime factors of a number are grouped in triples of equal factors, then that number is called a perfect cube.
Examples:
1. Resolving 250 as the product of prime factors
250 = 2 x 5x5x5
Since 2 does not exist in product of triples.
Therefore, 250 is not a perfect cube.
2. Resolving 5832 as the product of prime factors
5832 = 2x2x2 x 3x3x3 x 3x3x3
Since, they are grouped in triples.
Therefore, 5832 is a perfect cube
3. Resolving 1944 as the product of prime factors
1944 = 2x2x2 x 3x3x3 x 3x3
In order to make 1944 a perfect cube, it must be multiplied by 3.
=================================================