A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a program in C++ to check whether a given number is a perfect cube or not
Q:

Write a program in C++ to check whether a given number is a perfect cube or not

0

Write a program in C++ to check whether a given number is a perfect cube or not

Sample Output:

Check whether a number is a perfect cube or not:                      
 -----------------------------------------------------                 
 Input a number: 8                                                     
 The number is a perfect Cube of 2

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<iostream>
#include<math.h>
using namespace std;
int main() 
{ 
int num, curoot,ans; 

 cout << "\n\n Check whether a number is a perfect cube or not: \n";
 cout << " -----------------------------------------------------\n";
    cout<<" Input a number: ";
    cin>>num;
curoot=round(pow(num, 1.0/3.0));

if(curoot*curoot*curoot==num)
{
  cout<<" The number is a perfect Cube of "<<curoot<<endl;   
}
else
{
  cout<<" The number is not a perfect Cube."<<endl;   
}
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now