+ 1
Can you solve write a program in c++ to print cube of the given number
6 Respuestas
+ 28
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a;
cin >> a;
cout << "the cube of" << a << "is" << pow(a, 3) << endl;
return 0;
}
By using pow() function in cmath library you can count any power of a.
+ 7
the program is
#include <iostream.h>
void main() {
int a, b;
cout<<"enter a no.";
cin>>a;
b=a*a*a;
cout<<"The cube is "<<b;
}
you can use Rebeccas method too that works for more power
it uses math.h and the power function
you can make own power function by for loop
+ 2
I can give you a hint : The cube of a number is basically itself multiplied by itself thrice.
So the cube of a is a*a*a OR a^3.
+ 2
#include <iostream>
using namespace std;
int main() {
int x;
int Qube;
cout << "enter a number to sube root: " << endl;
cin >> x;
Qube = x*x*x;
cout << "the qube root of your answer is: " << Qube << endl;
return 0;
}
+ 1
read the value of x;
and then perform q=x*x*x;
0
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter a number for which you want to find the cube$ "<<endl;
cin>>n;
cout<<"Cube of a given number is"<<(n*n*n)<<endl;
}
cube is three times a number that's it buddy enjoy coding $$$dollars