和求约数是一回事吧~~
#include<stdio.h>
void main()
{
int num,i,a;
printf("enter the number:(q to quit)\n");
while(scanf("%d",&num)==1)
{
for(i=2,a=0;i*i<=num;i++)
{
if(num%i==0)
{printf("%d %d\n",i,num/i);
a++;
}
}
if(a==0)
printf("no number\n");
printf("enter next number:(q to quit)");
}
}
请问这个可以吗?
#include<stdio.h>
void main()
{
int num,i,a;
printf("enter the number:(q to quit)\n");
while(scanf("%d",&num)==1)
{
for(i=2,a=0;i*i<=num;i++)
{
if(num%i==0)
{printf("%d %d\n",i,num/i);
a++;
}
}
if(a==0)
printf("no number\n");
printf("enter next number:(q to quit)");
}
}
请问这个可以吗?