write a c programs Take integer and find all divisors/Factors , print is it prime or not? and how many divisors contain print it?(adsbygoogle = window.adsbygoogle || []).push({});

how to solve in one program and how many divisors/Factors

contains

my code:

Code (C):

#include<stdio.h>

#include<conio.h>

#include<math.h>

int main()

{

int number,i;

printf("This program calculate Divisors\n ");

printf("enter number= ");

scanf("%d",&number);

printf("Divisors are= ");

for(i=1;i<=number;i++)

{

if (number%i==0 )

{

printf("%4d",i);

}

}

getch();

return 0;

}

and

#include<stdio.h>

main()

{

int n, c = 2;

printf("Enter a number to check if it is prime\n");

scanf("%d",&n);

for ( c = 2 ; c <= n - 1 ; c++ )

{

if ( n%c == 0 )

{

printf("%d is not prime.\n", n);

break;

}

}

if ( c == n )

printf("%d is prime.\n", n);

return 0;

}

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Take integer and find divisors,prime? & how many divisors

Loading...

Similar Threads for integer find divisors |
---|

Large Joins in Large Databases -- How to find Keys? |

Can't find my Localhost Database Engine for SQL Server |

C/++/# Finding duplicates algorithm |

**Physics Forums | Science Articles, Homework Help, Discussion**