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

Why do we use static in c?

636


What is sizeof in c?

575


Why is c called "mother" language?

862


What are unions in c?

586


What are c identifiers?

631






1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if

3984


What are structure types in C?

677


What is structure packing in c?

613


Can a void pointer point to a function?

580


Is it cc or c in a letter?

574


how is the examination pattern?

1600


What is table lookup in c?

634


I came across some code that puts a (void) cast before each call to printf. Why?

686


What are the header files used in c language?

594


What do you mean by keywords in c?

632