Computer Science, asked by bijaivir, 11 months ago

write a program to print the sum of even number from 1 to 100

Answers

Answered by Anonymous
0

#include <stdio.h>

#include<conio.h>

int main()

{

int i, 100, sum=0;



printf("Enter upper limit: ");

scanf("%d", &100);


for(i=2; i<=100; i+=2)

{

/* Add current even number to sum */

sum += i;

}


printf("Sum of all even number between 1 to %d = %d", 100, sum);


return 0;

}


dessuabewa: can't we say
dessuabewa: for(int i=1;i<=100;i++) if(i%2==0){ sum+=i;}
Anonymous: Yes, you can say that
Anonymous: Sorry for late response, bro
Similar questions