c program to find sum of squares of even numbers

Program

C Program to find and print sum of square of even 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 even numbers: %d",sum);
   
   getch();
}

Output

sum of first 10 even numbers: 220

Explanation

  • This program calculates sum of those numbers which produces no remainder after dividing by 2 i.e.
    even numbers

  • Above program performs addition of square of first 10 even numbers i.e. sum of squares of 2,4,6,8,10

Leave a Reply

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