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
Explain what is page thrashing?
What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?
What do you mean by c what are the main characteristics of c language?
What is the meaning of && in c?
Explain enumerated types.
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.
What is merge sort in c?
Explain about C function prototype?
write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1
How can I find the modification date of a file?
Why main is used in c?
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above
can we have joblib in a proc ?
What is meant by 'bit masking'?
Tell me what is null pointer in c?