Who can answer this question ?

Write a program that uses loop o perform the following steps:
a.Prompt the user to input two integers: firstNum and secondNum (Use 3 for the firstNum and 15 for the secondNum).
b.Output the sum of the square of the odd and even numbers between the two numbers.
I think this will do
#include <stdio.h>

int _tmain(int argc, _TCHAR* argv[])
{
int count = 0;
int sum = 0 ;
do
{
if( (count % 2) != 0)
{
sum += (count * count);
}
count++;

}while( count < 16);
printf("The sum is = %d", sum);
return 0;
}
Topic archived. No new replies allowed.