Monday, 8 December 2014

C program to print Cube Root Of a Number

Cube Root Of a Number
#include<stdio.h>
main()
{
int num,i,r,sum=0,temp;
printf("enter any number\n");
scanf("%d",&num);
temp=num;
while(temp>0)
{
r=temp%10;
sum=sum+(r*r*r);
temp=temp/10;
}
printf("cube root of a number=%d\n",sum);
}
OutPut:
madan@madan-Lenovo-G570:~/madan$ ./a.out
enter any number
5
cube root of a number=125