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 / parekh nirav
#include<stdio.h>
#include<conio.h>
void main()
{
int i,no,sum=0;
clrscr();
printf("\n entre the no:-");
scanf("%d",&no);
for(i=2;i<=30;i+1)
{
printf("\n the list is %d",i);
sum=sum+i;
}
printf("\n the sum is %d",sum);
getch();
}
| Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
What is c basic?
What is calloc()?
What is the right type to use for boolean values in c? Is there a standard type?
What is the purpose of main( ) in c language?
How do you redirect a standard stream?
Why isnt there a numbered, multi-level break statement to break out
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit
What's the best way of making my program efficient?
What is a lvalue
Tell me about low level programming languages.
What is meant by gets in c?
I heard that you have to include stdio.h before calling printf. Why?
What is enumerated data type in c?
What is uint8 in c?
How do you determine the length of a string value that was stored in a variable?