From bfc53d3059ad619f2508dd51389bdd58cff18480 Mon Sep 17 00:00:00 2001 From: puy4bwhfe <3207267310@qq.com> Date: Sat, 19 Feb 2022 14:38:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=95=B0=E5=AD=97=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 判断数字类型 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 判断数字类型 diff --git a/判断数字类型 b/判断数字类型 new file mode 100644 index 0000000..050add0 --- /dev/null +++ b/判断数字类型 @@ -0,0 +1,23 @@ +#include +#include +int fun(int a) +{ + int ans = 0; + for(int i = 2; i <= sqrt(a); i++) + { + if(a%i==0) + { + ans = 1; + break; + } + } + return ans; +} +int main() +{ + int a; + scanf("%d",&a); + int ans = fun(a); + if(ans == 1) printf("NO"); + else printf("YES"); +} \ No newline at end of file