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

Explain the red-black trees?

1067


How to set file pointer to beginning c?

1168


Are there constructors in c?

979


What is a pointer in c plus plus?

1243


Who developed c language?

1050


How can I remove the trailing spaces from a string?

1039


Define Array of pointers.

1057


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1908


Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

1090


Which is the best website to learn c programming?

1050


Do pointers need to be initialized?

1039


What are c header files?

960


Can include files be nested?

1069


What is a newline escape sequence?

1062


What is structure in c language?

1117