Write a C program to find the number of and sum of all integers greater than 50 and less than 300 that are divisible by 9 using function.
#include <stdio.h>
#include <conio.h>
int div(int n);
int main()
{
int i,sum=0,m;
clrscr();
for(i=51;i<300;i++)
{
m=div(i);
sum=sum+m;
}
printf("\n\nSum of these numbers is: %d",sum);
getch();
}
int div(int n)
{
if(n%9==0)
return(n);
else
return(0);
}
#include <conio.h>
int div(int n);
int main()
{
int i,sum=0,m;
clrscr();
for(i=51;i<300;i++)
{
m=div(i);
sum=sum+m;
}
printf("\n\nSum of these numbers is: %d",sum);
getch();
}
int div(int n)
{
if(n%9==0)
return(n);
else
return(0);
}