/*****************<soeasyprograms.blogspot.in>******************/
#include<stdio.h>
#include<conio.h>
void main()
{
int n,x,i;
float sum=0,count=0,avg;
clrscr();
scanf("%d",&n);
printf("Enter the divisor number x ");
scanf("%d",&x);
for(i=1;i<=n;i++)
{
if(i%x==0)
{
sum=sum+i;
count=count+1;
}
}
printf("Sum of numbers upto %d divisible by %d is %f\n",n,x,sum);
avg=sum/count;
printf("Average is %f",avg);
getch();
}
/*End of program*/
/*****************<soeasyprograms.blogspot.in>******************/
No comments:
Post a Comment