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

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

Is This Answer Correct ?    3 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In which language linux is written?

1230


What is the main difference between calloc () and malloc ()?

1159


The difference between printf and fprintf is ?

1295


There seem to be a few missing operators ..

1052


Explain what is meant by high-order and low-order bytes?

1053


find the sum of two matrices and WAP for it.

1143


What does main () mean in c?

1101


Is main is a keyword in c?

1129


Explain what does a function declared as pascal do differently?

1300


What is dynamic variable in c?

1035


Is there a built-in function in C that can be used for sorting data?

1269


What is preprocessor with example?

1068


What is an endless loop?

1280


How do I convert a string to all upper or lower case?

1125


If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.

2278