Computer Science, asked by AQUIB7532, 9 months ago

Algorithm to find square of the inputted number

Answers

Answered by swastik95
5

Answer:

Divide the number in two parts with one part containing only the number at unit's place say part 'A', and other part say 'B', containing the remaining number.

Now square the number at unit's place. The square will be one of these; {0,1,4,9,16,25,36,49,64,81}. The unit's place digit in this square is the unit's place digit in actual final answer.Write it in the answer. If the square of digit at unit's place is a two digit no like from 16 to 81 in above set; write only the digit at unit's place from this square in the final answer and carry the remaining digit.

Multiply the actual number to be squared by part 'B'(the remaining part than the number at unit's place as described in step 1 ).

Multiply the parts 'A' and 'B'.

Add results of step 3 with results of step 4.

Add the carried digit from step 2 to the sum in prior step, that is step 5.

Now write this sum before the number we wrote at unit's place of final answer in step 2.

This number we now obtain from step 7, is the square of our number.

Explanation:

Example:

Lets find square of 127 by above algorithm;

1. A = 7 and B = 12 here...

2. A^2 = 49 thus final answer will have 9 at units place and 4 is carried to add later.

3. Given number multiplied by 'B' => 127*12 = 1524

4. A*B => 12*7 = 84

5. 1524+84 = 1608 ..... ( step 3 + step 4 )

Hope this answer will help u and pls follow me!!

Similar questions