• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
zhm521
博客园 首页 新随笔 联系 订阅 订阅 管理

2020年10月16日

给定两个数,求这两个数的最大公约数
摘要: //第一次尝试:#include<stdio.h> void math_gys(int a, int b){ int t = 0; if (a < b){ t = a; } else{ t = b; } for (int i = t; i <= a && i <= b; i--){ if (a % 阅读全文
posted @ 2020-10-16 18:45 zhm521 阅读(294) 评论(0) 推荐(0)
 
打印1-100之间所有3的倍数的数字
摘要: //第一次尝试:#include<stdio.h> int main(){ for (int i = 1; i < 101; i++){ if (i % 3 ==0){ printf("%d ", i); } } return 0; }//此代码比较简短,比较简单。 阅读全文
posted @ 2020-10-16 16:37 zhm521 阅读(725) 评论(0) 推荐(0)
 
将三个数按从大到小输出
摘要: //第一次尝试: #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> void compare(int x, int y, int z){ if (x > y){ if (y > z){ printf("%d %d %d", x, y, z); } e 阅读全文
posted @ 2020-10-16 16:23 zhm521 阅读(571) 评论(0) 推荐(0)
 
写一个函数求两个数的较大值
摘要: //第一次尝试:#include"stdio.h" void compare(int a, int b) { if (a > b) { printf("%d>%d\n",a,b); } else if (a < b) { printf("%d<%d\n",a,b); } else { printf( 阅读全文
posted @ 2020-10-16 15:42 zhm521 阅读(676) 评论(0) 推荐(0)
 
 

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3