Write a c code segment using a for loop that calculates and
prints the sum of the even integers from 2 to 30, inclusive?
Answer Posted / vignesh1998i
#include<stdio.h>
#include<conio.h>
void main()
{
int m,n,sum=0;
clrscr();
printf("enter the starting point :");
scanf("%d",&m);
printf("ending point :");
scanf("%d",&n);
for(int i=m;i<=n;i+=2)
sum+=i;printf("\n\nthe sum is %d:",sum);
getch();
}
thank u
Is This Answer Correct ? | 6 Yes | 5 No |
Post New Answer View All Answers
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
Can you explain the four storage classes in C?
show how link list can be used to repersent the following polynomial i) 5x+2
What is bash c?
There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?
What is local and global variable in c?
In a header file whether functions are declared or defined?
What is a static variable in c?
How do you declare a variable that will hold string values?
how logic is used
#include
What is a loop?
What is the difference between text and binary i/o?
can we implement multi-threads in c.
What is a function in c?