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

An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode

1092


What is array within structure?

1131


What is the difference between call by value and call by reference in c?

1168


how logic is used

1977


How can I write a function that takes a format string and a variable number of arguments?

1060


How can you check to see whether a symbol is defined?

1104


What is the meaning of typedef struct in c?

1072


what is bit rate & baud rate? plz give wave forms

1982


Who invented b language?

1422


How can I access an I o board directly?

1093


Can the size of an array be declared at runtime?

1089


What is unsigned int in c?

1007


Why do we use header files in c?

1079


What is scope and lifetime of a variable in c?

1078


write a programming in c to find the sum of all elements in an array through function.

2181