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

wchenfeng

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

1 2 3 4 5 ··· 32 下一页

2022年4月12日

编写程序,输入一个整数,使用逻辑表达式计算该数“大于100或小于0”的结果并输出。 例如:输入-200,则输出1

摘要: #includeint main(){ int a; scanf("%d",&a); printf("%d\n",a>100||a<0); return 0;} 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(132) 评论(0) 推荐(0)

(1)有一函数: 当x<1时,y=x 当1<=x<10时,y=2x-1 当x>=10时,y=3x-11 编写程序输入x,输出y的值

摘要: #includeint main(){ int x,y; scanf("%d",&x); if (x<1) y=x; else if (x<10) y=2*x-1; else y=3*x-11; printf("%d\n",y); return 0;} ... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(157) 评论(0) 推荐(0)

输入几个字符串,比较找出其中最小的字符串

摘要: #include#include#define N 20#define M 81int getstr(char p[][M]){ char t[M],n=0; printf("enter string a empty string to end\n... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(125) 评论(0) 推荐(0)

第四章选择结构,从键盘输入任意一个数,判断是否为素数。

摘要: #include #include int is_prime(int n){ int a,b=1,k; k=sqrt (n); for(a=2;a<=k;a++) { if(n%a==0) { b=0; break ; } } if(n==... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(148) 评论(0) 推荐(0)

根据年月日,判断已经多少天

摘要: #includeint get_days_of_month(int year, int month){//补足函数 int days,flag; //printf("Please input year:"); // ... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(267) 评论(0) 推荐(0)

输入一串数字,正向输出数字

摘要: #include #include void main(){ int a,i,c,b,t; scanf("%d",&a); t=a;i=0; while(t>0){t=t/10;i++;} //计算a的位数i for(b=i-1; b>=0... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(35) 评论(0) 推荐(0)

信函的重量不超过100g时,每20g付邮资80分,编写程序输入信函的重量,若不超过100g则输出应付的邮资。

摘要: #includeint main() { int x,y;scanf("%d",&x);y=x/10;switch(y){ case 0:case 1:printf("80");break;case 2:case 3:printf("160");brea... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(144) 评论(0) 推荐(0)

输入一串数字,逆向,反向输出数字

摘要: #include void main(){int a,ret=0,t;scanf("%d",&a);while(a>0){ t=a%10; ret=t;printf("%d",ret); a=a/10; }} 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(113) 评论(0) 推荐(0)

1/1+1/2+1/3+....1/n的和计算

摘要: #include "stdio.h"int main(void){ float value,sum=0.0; unsigned n=0; scanf("%f",&value); do { sum+=(float)1.0/++... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(250) 评论(0) 推荐(0)

输入一串数字,逆向反向输出数字2

摘要: #include void main(){ int a,b,c,n; scanf("%d",&n); a=n/100; b=n/10%10; c=n%10; printf("%d%d%d",c,b,a);} 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(42) 评论(0) 推荐(0)

1 2 3 4 5 ··· 32 下一页
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3