Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int numero = 0;
  8. int kuutio = 0;
  9. int kuutiojuuri = 0;
  10. cout << "Enter a number: ";
  11. cin >> numero;
  12. kuutio = numero * numero * numero;
  13. if ( numero == 0 ) {
  14. cout << "The cube of 0 is 0." << endl;
  15. } else {
  16. kuutiojuuri = kuutio / numero / numero;
  17. if ( kuutiojuuri != numero ) {
  18. cout << "Error! The cube of " << numero << " is not " << kuutio << "." << endl;
  19. } else {
  20. cout << "The cube of " << numero << " is " << kuutio << "." << endl;
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement