Recent Posts

9-latest-250px-course

Write a C Program to find the number of integers with exactly 9 divisors

Write a C Program to find the number of integers with exactly 9 divisors



Program:-     

#include
int count_no_of_divisors(int num)
{
int count = 0;
for (int i = 1; i <= num; i++)
{
if (num % i == 0)
count = count + 1;
}
return count;
}

void check_9_factors(int n)
{
int c = 0;
for (int i = 1; i <= n; i++)
{
if (count_no_of_divisors(i) == 9)
{
printf(“%d “, i);
c = c + 1;
}
}
printf(“\n\nTotal = %d\n”, c);
}

int main()
{
int n;
printf(“\nEnter the number : “);
scanf(“%d”, &n);
printf(“\nThe number which has exactly 9 divisors : “);
check_9_factors(n);
return 0;
}

Output:-

....
SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment