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 / na
#include<stdio.h>
main()
{
int i;
int sum=0;
for(i=2;i<=30;i++)
{
if(i%2==0)
{
sum=sum+i;
}
}
printf("%d",sum);
return 0;
}
| Is This Answer Correct ? | 3 Yes | 4 No |
Post New Answer View All Answers
What is methods in c?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
Explain the process of converting a Tree into a Binary Tree.
What is the function of this pointer?
What is the data segment that is followed by c?
Stimulate calculator using Switch-case-default statement for two numbers
What is scope of variable in c?
write a program to copy the string using switch case?
Is c compiled or interpreted?
What is #define in c?
What is spaghetti programming?
What does 3 periods mean in texting?
What is header file definition?
Does c have class?
Do you know null pointer?