安全问答

安全问答是一个知识全球问答,包含丰富的问答知识

首页 常规 游戏 娱乐 科技 程序员

编写函数int prmint n判断n是否是素数定义main函数输入m值调用prm函数判断在main函数中输出1~m之间的所有素数输出格式d 。【样例输入】80【样例输出】2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 #include stdioh#include stdlibh#include mathhint

  • 日期: 2027-08-20
  • 标签: 社会

int prm(int n) { int i; if(n<=1) return 0;//小于等于1不是素数 for(i=2;i<=sqrt(n);i++) { if(n%i==0) return 0;//能整除不是素数 } return 1;//是素数 }

编写函数int prmint n判断n是否是素数定义main函数输入m值调用prm函数判断在main函数中输出1~m之间的所有素数输出格式d 。【样例输入】80【样例输出】2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 #include stdioh#include stdlibh#include mathhint

原文地址: https://www.cveoy.top/t/topic/evEI 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录

  • 上一篇: 成都铁路运输职业学校就业保障怎么样
  • 下一篇: 选择成都高铁专业学校就业轻松吗

© 2019 • 2025 - 安全问答 站长邮箱:wxgpt@qq.com    ICP备案/许可证号:豫ICP备2024104334号-2