How to write program for finding cubic root of a number?
[b]Question asked by visitor vidhya[/b]
Printable View
How to write program for finding cubic root of a number?
[b]Question asked by visitor vidhya[/b]
main()
{
//read the value n;
for(i=1;i<=n;i++)
{
a=i*i*i;
if(a==n)
cout<<"cubic root is "<<a;
}
}
#include<iostream.h>
#include<conio.h>
#include<math.h>
main(void)
{ int i,c,n;
cout<<"enter a no\n";
cin>>n;
for(i=1;i<=n;i++)
{ c=i*i*i;
if(c==n)
{ cout<<"cube root:"<<i;
break;}
}
cout<<"out of loop ans got\n";
getch();
}