Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / rukmanee

#include<stdio.h>
#include<conio.h>
main()
{
int i;
int sum=0;
clrscr();
for(i=2;i<=30;i++)
{
if(i%2==0)
{
sum=sum+i;
}
}
printf("%d",sum);
getch();
}
output:240

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you define which header file to include at compile time?

982


Where are some collections of useful code fragments and examples?

1107


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

1155


What are header files why are they important?

1044


Why we use stdio h in c?

983


how many errors in c explain deply

2036


What are the types of bitwise operator?

1048


The file stdio.h, what does it contain?

1116


How can I find out how much free space is available on disk?

1014


What is the use of structure padding in c?

1014


Can we declare a function inside a function in c?

989


The difference between printf and fprintf is ?

1213


What is the difference between the = symbol and == symbol?

1054


What is an array in c?

1001


Why use int main instead of void main?

1072