Search This Blog

Translate

c program print prime divisor of given number

c program print prime divisor of given number,c program to print prime numbers in a given range,c program to print prime numbers between given range,c program to print prime numbers from 1 to n,c program to print prime numbers from 1 to 100,c program to print prime numbers upto n,c program to print prime numbers using for loop,c program to print prime numbers from 1 to 50,c program to print prime numbers between two numbers

c program print prime divisor of given number


#include"stdio.h"
#include"conio.h"
void main()
{
int no,n,prime[20],factor[20],i,j=0,k=0,p=0,flag;
clrscr();
printf("Enter the number=");
scanf("%d",&no);
for(i=1;i<no;i++)
{
if(no%i==0)
{
factor[j]=i;
j++;
}

}
printf("\n\nFactor of a given number is=");
for(i=0;i<j;i++)
{
printf(" %d",factor[i]);
}
for(i=0;i<j;i++)
{
n=factor[i];
flag=0;
for(k=2;k<n;k++)
{
if(factor[i]%k==0)
      {
flag=1;
break;
}
}

if(flag==0)
{
prime[p]=factor[i];
p++;
}
}
printf("\n\nPrime factor of a given number is=");
for(i=0;i<p;i++)
{
printf(" %d",prime[i]);
}
getch();
}


c program print prime divisor of given number,c program to print prime numbers in a given range,c program to print prime numbers between given range,c program to print prime numbers from 1 to n,c program to print prime numbers from 1 to 100,c program to print prime numbers upto n,c program to print prime numbers using for loop,c program to print prime numbers from 1 to 50,c program to print prime numbers between two numbers

C Program example List

Google+ Badge