Skip to main content
Program of Least Prime Factor in C
#include
int main()
{
int t,i;
scanf("%d",&t);
for(i=0;i
{
int n,j,flag,k;
scanf("%d",&n);
flag=0;
for(j=1;j<=n;j++)
{
for(k=2;k<=j;k++)
{
if(j%k==0)
{
printf("%d ",k);
flag=1;
break;
}
}
if(flag==0)
{
printf("%d ",j);
}
}
}
Subscribe My Channel
ReplyDelete