以下为代码,今天才把turbo装上,第二天摸到书,自学中,请前辈指教
#include <stdio.h>
int pdzs(int zssr)
{
int fenmu;
int yushu;
int yesno; /*=1 shi zhi shu ,=0 bu shi zhi shu*/
for(fenmu=2;zssr/fenmu>1;fenmu++)
{
yushu=zssr%fenmu;
if(yushu==0)
{
yesno=0; /* yesno=0 shi,bu shi zhi shu*/
printf("%i bushi \n",zssr); /*ce shi shu chu*/
break;
}
yesno=1;
}
if(yesno==1)
printf("%i \n",zssr);
}
main()
{
int m;
int chushu;
int i;
printf("ji shu ren yi zi ran shu yi nei de zhi shu(yao qiu da yu 2): \n");
scanf("%d",&m);
for(i=2;i<=m;i++)
{
printf("jisuan %i k ",i); /*ce shi shu chu*/
pdzs(i);
}
printf("END! \n");
}
浊酒丶
YORK_CAPPUCCINO
YORK_CAPPUCCINO
相关分类