4-4

#include<stdio.h>

int main(void)

{

         int i,m;

 

         printf("Enter a number:");

         scanf("%d",&m);

         for(i=2;i<=m/2;i++)

                   if(m%i==0)

                            break;

                   if(i>=m/2&&m!=1)

                            printf("%d is a prime number!\n",m);

                   else

                            printf("No!\n");

 

                   return 0;

}

posted @ 2013-10-04 18:14  zhaoyang16  阅读(80)  评论(0编辑  收藏  举报