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

What is methods in c?

1038


In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

1185


Explain the process of converting a Tree into a Binary Tree.

2625


What is the function of this pointer?

1244


What is the data segment that is followed by c?

1040


Stimulate calculator using Switch-case-default statement for two numbers

2934


What is scope of variable in c?

1007


write a program to copy the string using switch case?

2860


Is c compiled or interpreted?

1143


What is #define in c?

999


What is spaghetti programming?

1084


What does 3 periods mean in texting?

1022


What is header file definition?

1040


Does c have class?

1060


Do you know null pointer?

982