Function call
/*
==========================================================
Title: Judge whether a number is a prime. If 3 is a prime number, 4 is not a prime number.
==========================================================
*/
#include <stdio.h>
#include <stdlib.h>
int Sushu (int n)
{
int i,k;
k=n/2;//Control End Position!
for (i=2;i<=k;i++)
if (n%i==0) break;
if (i>k) return 1;
else return 0;
}
void Main ()
{
int n,flag=1;
while (flag)
{
printf ("Please enter judgment number: \ n");
scanf ("%d", &n);
System ("CLS");
if (Sushu (n))
printf ("%d is a prime number!") \ nthe ", n);
Else
printf ("%d is not a prime number!") \ nthe ", n);
}
System ("CLS");
}
/*
==========================================================
Comment: First write the function of prime number, is returns 1, no return 0, and then call the function to judge continuously.
==========================================================
*/
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
C language Function Call 09-Determine whether a number is a prime