在使用壹個函數之前必須先對他進行聲明:
//void B();聲明B函數的存在。void A(){B();//非法,程序執行到此時並不知道B函數的存在。}void B(){}
或者
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int fa(int n)
{
int a;
for(a=2;a<=sqrt(n*1.0),n%a!=0;a++);
if(a>sqrt(n*1.0))
return(1);
else
return(0);
}
void main( )
{
int n,q;
scanf("%d",&n);
擴展資料
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int fa(int n)
{
int a;
for(a=2;a<=sqrt(n*1.0),n%a!=0;a++);
if(a>sqrt(n*1.0))
return(1);
else
return(0);
}
void main( )
{
int n,q;
scanf("%d",&n);
if(fa(n)==1)
printf("n");
else
printf("y");
system("pause");
exit(0);
}
參考資料: