C program to find sum of squares of odd numbers

Program

C Program to find and print sum of square of odd numbers

#include<stdio.h>
#include<conio.h>
void main()
{
   int num, sum=0;
   for(num=1; num<=10;num++)
   {
     if(num%2!=0)
        sum=sum+num*num; 
   }
   printf("n Sum of square of first 10 odd numbers: %d",sum);
   
   getch();
}

Output

sum of first 10 odd numbers: 165

Leave a Reply

error: Content is protected !!
%d bloggers like this: