How to input the square and cube numbers in c++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to input the square and cube numbers in c++?

16th Sep 2017, 9:52 AM
Rabin Singh
Rabin Singh - avatar
3 Answers
+ 8
Or #include <cmath> and use pow(number, 2) for square or pow(number, 3) for cube, though it's inefficient.
16th Sep 2017, 10:16 AM
Karl T.
Karl T. - avatar
+ 1
thank you for your good answer .karl
16th Sep 2017, 1:47 PM
Rabin Singh
Rabin Singh - avatar
0
For square multiply it for 2 time example int a than a will be a*a; For cube 3 times like - a*a*a;
16th Sep 2017, 10:13 AM
Irwin Lopez
Irwin Lopez - avatar