write a program to print sum of all the even numbers from 22 to 86
Answers
Answered by
0
Answer:
#include <stdio.h>
int main() {
int counter;
printf("Even numbers between 22 to 86\n");
/*
* Initialize counter with 1, and increment it in every iteration.
* For every value of counter check whether it is even number or
* not and print it accordingly
*/
for(counter = 22; counter <= 86; counter++) {
/* Even numbers are divisible by 2 */
if(counter%2 == 0) {
/* counter is even, print it */
printf("%d ", counter);
}
}
return 0;
}
Explanation:
Answered by
0
Answer:
hi...its a python code
Explanation:
sum=0
for i in range(22,87):
if i%2==0:
sum+=i
print(sum,"is the required answer")
hope it helps you
please mark brainliest
Similar questions