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


Please Help Members By Posting Answers For Below Questions

Is int a keyword in c?

550


hi send me sample aptitude papers of cts?

1645


What are c preprocessors?

669


Which of these functions is safer to use : fgets(), gets()? Why?

627


What is difference between && and & in c?

573






What is getch?

624


what is the role you expect in software industry?

1645


Can one function call another?

619


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.

1612


What are type modifiers in c?

614


Which function in C can be used to append a string to another string?

639


What is the use of static variable in c?

587


Explain what’s a signal? Explain what do I use signals for?

604


What are the types of arrays in c?

617


If fflush wont work, what can I use to flush input?

602