TO CALCULATE THE SUM OF FIRST N EVEN NUMBERS


#include<stdio.h>
void main()
{
int n, sum, i;
printf("Enter value of n");
scanf("%d",&n);
for(i = 1, sum = 2; i <= n; i++)
sum += 2;

printf("Sum of first %d even numbers is = %d",n,sum);




}

11 comments: (+add yours?)

senses said...

wuiiii full program ++

Anonymous said...

:):):)

Anonymous said...

Nice blog dude......
Keep it up....
My Email I'd - Jafarbhai_2005@yahoo.com

Anonymous said...

sum=0 there else the sum will come wrong!

Siraj Shaikh said...

Above Program is Executed.

Anonymous said...

U r not using clrscr (); for clear the page

Siraj Shaikh said...

so you use clrscr()...

Unknown said...

Sir plz help me algirthm to find sum of first n even numbers

Unknown said...

Sir plz help me algirthm to find sum of first n even numbers

Anonymous said...

Sir plz help me algirthm to find sum of first n even numbers

Siraj Shaikh said...

Sorry for late reply.
I have stopped posting programs due to some reason.
Will try to start again posting later on.

Post a Comment