Thursday, August 29

Trick to Find Cube Root of a number without Calculator








Today I 'm gonna share a simple  trick to find the Cube Root of any number (perfect Cubes only) without the need of any calculator..!! A sample C program is also providing to  prove this trick will work correctly for all perfect cubes.!!
Here We Go..!!  :)








Trick Used:

We will follow these steps to find the cube root of a number:

1. Ignore the last 3 digits of the number. Let remaining number be “Part1”.
2. From the above table check which number’s cube is less than or equal to ‘Part1’. It will be left part of our answer. Let it be “L”.
3. Let Right part of our answer be “R”. It will be determined from the above table. For Ex. If last digit of question is 7, then last digit of our answer will be 3
4. Our answer will be L|R.


Example 1
Suppose we want to find the cube root of 21952.
Step 1: Ignore last three digits of 21952. Remaining number left is ’21′.
Step 2: From the above table cube of ’2′ is less than ’21′. Therefore left part (L) of our answer will be ’2′.
Step 3: Since last digit of ‘21952‘ is ‘2‘. Therefore right part (R) of our answer will be ’8′. (Because Last digit of ‘cube of 8′ is 2. see table above.)
Step 4: Our Answer will be L|R. Therefore Answer will be 2|8 = 28.

PROOF

This C program verifies  this trick that it will work correctly for all perfect cubes.!!

#include<stdio.h>

int main()

{
 int cube[]= {0,1,8,27,64,125, 216,343 ,512 ,729 };
 int last_digit[]={0,1,8,7,4,5,6,3,2,9};
 int i=0,j=0, num, part1,part2, ans1, ans2,flag;


flag =1;
for (i=0 ;i<44;i++)
{
num =i*i*i;                  // eg : 21952
part1 =  num/1000;           // 21
for (j=0;j<10;j++)

if (cube[j]>part1)           // 27>21
 break;                      //j=3
  ans1 =j-1;                 // ans1 =2

part2 = num%10;              //2
for (j=0;j<10;j++)
if(part2 == last_digit[j]) break;

ans2 = j;                    //8

ans1= ans1*10 +ans2;         //28

if (i!=ans1)  flag = 0;

}    
 if (flag) printf ("VERIFIED");
else printf ("ERROR OCCURED");

      return 1;
      }




Hope this post was useful for you.!!
Your feedback and suggestion are always welcome..!! Keep in touch.
hugs :)



1 comments :

hitesh kumar said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Cube Root Program in C++

Nice post, It's really very simple and easy. Keep sharing.

Post a Comment