### Extracting Cube Roots Mentally

A cube is a number multiplied by itself twice more. For example, 3 cubed (33) is 3×3×3, or 27. A cube root is the number that, when cubed, results in a given number. For example, the cube root of 27 is 3.

Here is the fastest and easiest technique of extracting Cube Roots mentally. A bit of homework is required for this trick. First, memorize the cubes of the digits 1 through 10:

 13 = 1      23 = 8      33 = 27      43 = 64      53 = 125 63 =  216      73 =  343      83 =  512      93 =  729    103 = 1000

Also keep in mind the "endings" (or last digit) of the cubes. For example, the ending of 93 is 9, because 93 = 729. So let's make a list. If the number ends in:

0 -> the last digit of the cube root is 0.
1 -> the last digit of the cube root is 1.
2 -> the last digit of the cube root is 8.
3 -> the last digit of the cube root is 7.
4 -> the last digit of the cube root is 4.
5 -> the last digit of the cube root  is 5.
6 -> the last digit of the cube root is 6.
7 -> the last digit of the cube root is 3.
8 -> the last digit of the cube root is 2.
9 -> the last digit of the cube root is 9.

These are easily memorized. 1 and 9 (at the extremes) are "self-endears", as are the 4, 5, and 6 (in the center). The others involve ‘a sum of 10’: 2 ends in 8, 8 ends in 2, 3 ends in 7, and 7 ends in 3.

Now how to do the trick!

Step-1:  Look at the magnitude of the thousands number (the numbers preceding the last three digits) to the left of the comma, and find the largest cube that is equal to or less than the number. This is the 1st part of the answer.
Step-2:  For the 2nd part (ending digit) of the answer; look at the last digit of the number and write the corresponding cube root for that “endings”.

For example, let’s say you want to extract the cube root of 39,304. You would mentally split it into “39” and “304”.

Step-1:  Take the first part i.e. '39' and find the largest cube that is equal to or less than '39'. (That’s why knowing the cubes of numbers 1-10 is needed)

Here, 39 is greater than 1 cubed, greater than 2 cubed, greater than 3 cubed, but not greater than 4 cubed. The greatest cube it is greater than is 3, so the first digit of the two digit cube root is 3.

Step-2:  Now for the 2nd part; look at the last digit which is 4. That's the same ending as 43. (This is why knowing the "endings" of the cubes for digits 1 through 9 is needed)

Therefore, the last (units) digit of the cube root is 4. So, the cube root of 39,304 is 34.

Another Example: Cube Root of 300,763 =?

1.  Look at the magnitude of the thousands number (leaving the last three digits) which is 300 and find the largest cube that is equal to or less than the number. Now,63 = 216, and 73 = 343. So, the tens-digit of the cube root is 6. This is the 1st part of the answer.

2.  Now look at the last digit, 3. That's the same ending as 73, so the units-digit is 7.
Therefore, the cube root of 300,763 is 67.

Further example: Find the cube root of 456,533.

1)  The magnitude of the thousands number 456 is greater than all the cubes up to 7 cubed. So, the first digit of the cube root is 7.

2)  For the 2nd digit of the answer; look the last digit of the number which is 3. We know if the numbers ends in 3; the cube root ends in 7.

Therefore, the cube root of 456,533 is 77.

Cube root of 778,688 =?

1)  Look at 778.  We know, 93 = 729 and 103 = 1000. So, the first digit of the cube root should be 9.

2)  For the ending digit of the answer; look at the last digit of the number which is 8. We know if the numbers ends in 8; the cube root ends in 2.

Therefore, the cube root of 778,688 is 92.

Cube root of 1,601,613 =?

1)    Take 1601. Now, 113 = 1331 and 123 = 1728, so the first digits are 11.
2)    The number ends in 3. So the last digit of the cube root is 7.

Therefore, the cube root of 1,601,613 is 117.

This method works up to 1,000,000 for true cubes.

### C Questions

C Questions
C Questions

Note : All the programs are tested under Turbo C/C++ compilers.
It is assumed that,
Programs run under DOS environment, The underlying machine is an x86 system, Program is compiled using Turbo C/C++ compiler.
The program output may depend on the information based on this assumptions (for example sizeof(int) == 2 may be assumed).
Predict the output or error(s) for the following:

void main()
{
int const * p=5; printf("%d",++(*p));
}
Compiler error: Cannot modify a constant value.
Explanation:
p is a pointer to a "constant integer". But we tried to change the value of the "constant integer".
main()
{
char s[ ]="man"; int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}
aaaa nnnn
Explanation

### Zoho Interview | Set 1 (Advanced Programming Round)

Third Round: (Advanced Programming Round) Here they asked us to create a “Railway reservation system” and gave us 4 modules. The modules were:
1. Booking
2. Availability checking
3. Cancellation
4. Prepare chart
We were asked to create the modules for representing each data first and to continue with the implementation phase.

My Solution :