Computer Science, asked by Queeny111, 6 months ago

Algorithm To find the sum of squares of two numbers

Answers

Answered by nikunjc971
1

Answer:

You can probably calculate a simple result/formula by considering partial sums, but it is also simple to write a program to do it by brute force.

Here is a Fortran 95 program that accomplishes the task:

Program DiffSquareOfSumAndSumOfSquares

integer SumOfSquares, Sum, SquareOfSum, Difference, i, UpperLimit

SumOfSquares = 0

Sum = 0

SquareOfSum = 0

Difference = 0

UpperLimit = 99

do i = 0, UpperLimit

SumOfSquares = SumOfSquares + i**2

Sum = Sum + i

end do

SquareOfSum = Sum**2

Difference = SquareOfSum - SumOfSquares

print *, "The square of the sum is", SquareOfSum

print *, "The sum of the squares is", SumOfSquares

print *, "Sum of squares - square of sums is", Difference

end program DiffSquareOfSumAndSumOfSquares

I considered 0 to be a natural number.

Explanation:

Mark this answer brainlist

Answered by AllenGPhilip
3

Answer:

Explanation:

Step 1 : Start

Step 2 : Input A , B

Step 3 : C = (A * A)

Step 4 : D = (B * B)

Step 5 : E = C + D

Step 6 :  Output = E

Step 7 : Stop

Similar questions