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
In which language linux is written?
What is the main difference between calloc () and malloc ()?
The difference between printf and fprintf is ?
There seem to be a few missing operators ..
Explain what is meant by high-order and low-order bytes?
find the sum of two matrices and WAP for it.
What does main () mean in c?
Is main is a keyword in c?
Explain what does a function declared as pascal do differently?
What is dynamic variable in c?
Is there a built-in function in C that can be used for sorting data?
What is preprocessor with example?
What is an endless loop?
How do I convert a string to all upper or lower case?
If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.