Computer Science, asked by ishaelizabeth, 11 months ago

Write an algorithm to find the square of a number

Answers

Answered by Avni2348
23

Explanation:

Algorithm is as follows: 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}.

Answered by Anonymous
4

As follows is the algorithm:

1)• Divide the number into two parts, one holding only the number at the unit's location referred to as part 'A,' and the other containing the remainder referred to as part 'B.'

• At the unit's location, square the number. 0-1,4,9,16,25,36,49,64,81 will be the square.

• In this square, the unit's place digit matches the unit's place digit in the final solution.

2)• In the answer, write it down. If the square of the digit at the unit's place is a two-digit number, such as 16 to 81 in the above set, in the final solution, write only the digit at the unit's place from this square and carry the remaining digit.

• Partially multiply the actual number that needs to be squared.

3)• Multiply the squared number by part 'B' (the remaining portion, then the number at the unit's location, as described in step 1).

4)• Multiply the 'A' and 'B' components together.

5)• Step 3's results should be combined with Step 4's results.

6)• Step 5 is to add the carried digit from step 2 to the amount from the previous step.

7)• Now, write this sum before the number we wrote in step 2 at the unit's final response location.

8)• The square of our number is the number we now have from step 7.

Similar questions