Computer Science, asked by saladistv, 8 hours ago

How to find the sum of squares of odd numbers using python or c or any computer language. ​

Answers

Answered by ishamakkar73
0

Answer:

Hello,

Here is how I did this:

// declare vaiables

int minNumber = 1, maxNumber = 30; //loop bounds

int loopCounter; // to use in the for loop

int totalSum = 0; // to get the sum from 1 to 30

// for loop to calculate the sum

for (loopCounter = minNumber; loopCounter <= maxNumber; loopCounter++)

{

// to only get the odd numbers

if (loopCounter % 2 != 0)

{

// to calculate

totalSum = totalSum + loopCounter;

}// end if

}// end for

Hope this helps!!

Similar questions