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

#include<stdio.h>
#include<conio.h>
void main()
{
int m,n,sum=0;
clrscr();
printf("enter the starting point :");
scanf("%d",&m);
printf("ending point :");
scanf("%d",&n);
for(int i=m;i<=n;i+=2)
sum+=i;printf("\n\nthe sum is %d:",sum);
getch();
}


thank u

Is This Answer Correct ?    6 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I get the current date or time of day in a c program?

1187


what is the difference between class and unio?

2320


What are the types of macro formats?

1072


Can you please explain the difference between syntax vs logical error?

1145


why we wont use '&' sing in aceesing the string using scanf

2333


Can true be a variable name in c?

1006


Who developed c language?

1053


Why should I use standard library functions instead of writing my own?

1223


How do we open a binary file in Read/Write mode in C?

1207


What is a floating point in c?

1028


How are structure passing and returning implemented?

1007


Differentiate between ordinary variable and pointer in c.

1120


What is file in c preprocessor?

1101


Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

15750


Explain zero based addressing.

980