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

In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none

1263


What is the use of pragma in embedded c?

1098


Is it possible to initialize a variable at the time it was declared?

1257


What is difference between array and pointer in c?

1141


The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.

1676


The statement, int(*x[]) () what does in indicate?

1204


How to delete a node from linked list w/o using collectons?

2824


What is the difference between functions getch() and getche()?

1138


what is the syallabus of computer science students in group- 1?

2368


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

1198


Find MAXIMUM of three distinct integers using a single C statement

1114


What are the keywords in c?

1173


If the size of int data type is two bytes, what is the range of signed int data type?

1070


Can you subtract pointers from each other? Why would you?

1005


Is exit(status) truly equivalent to returning the same status from main?

1116