Shopping In MUMBAI

Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top. Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.

Wednesday, December 31, 2008

C Program to print average of even numbers below a range

C Program to print average of even numbers below a range

#include
#include
void main()
{
int i,num,count=0,sum=0;
float avg;
clrscr();
printf("enter the range\n");
scanf("%d",&num);
printf("\nEven numbers:");
for(i=1;i<=num;i++)
{
if(i%2==0)
{
count++;
sum=sum+i;
printf("\n%d",i);
}
}
avg=sum/count;
printf("\nAverage of even numbers:%f",avg);
getch();
}

***************OUTPUT*****************
enter the range
10

Even numbers:
2
4
6
8
10
Average of even numbers:6.000000

C Program to print average of even numbers below a rangeSocialTwist Tell-a-Friend

0 comments:

SUPPORT THIS BLOG