google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a c program to find the sum of even numbers in the given range - 2nd puc computer science

Write a c program to find the sum of even numbers in the given range

Write a c program to find the sum of even numbers in the given range

#include<stdio.h>

#include<conio.h>

void main()

{

int start,end,i,sum=0;

printf("Enter the beginning and end range of number:\n");

scanf("%d%d",&start,&end);

for(i=start;i<=end;i++)

if(i%2==0)

sum=sum+i;

printf("sum=%d",sum);

getch();

}

Output:

Enter the beginning and end range of number:

10

15

sum=36


Write a c program to find the sum of even numbers in the given range Write a c program to find the sum of even numbers in the given range Reviewed by Vision Academy on December 25, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.