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
Is int a keyword in c?
hi send me sample aptitude papers of cts?
What are c preprocessors?
Which of these functions is safer to use : fgets(), gets()? Why?
What is difference between && and & in c?
What is getch?
what is the role you expect in software industry?
Can one function call another?
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
What are type modifiers in c?
Which function in C can be used to append a string to another string?
What is the use of static variable in c?
Explain what’s a signal? Explain what do I use signals for?
What are the types of arrays in c?
If fflush wont work, what can I use to flush input?