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

wchenfeng

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

公告

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 32 下一页

2022年4月12日

编写程序计算1!+2!+·······+n!。n的值由键盘输入(n的值在10以内)

摘要: #includeint main(){ int n,sum,i; long fac; scanf("%d",&n); fac=1,sum=0; for(i=1;i<=n;i++) {fac=i*fac; sum=fac+sum; } printf("%d",... 阅读全文

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

编写程序计算了整数2-20中所有整数的不含有1的因子数量,并将因子数量为奇数的整数输出出来。

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

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

编写一个函数,在主函数从键盘输入两个正整数,调用该函数求取这两个数的最小公倍数。

摘要: #include int lcm (int a,int b){ int i=1,last=1,min=1,z; if(aint main(){ int m, n;int i = 2; int j, k; int l... 阅读全文

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

(2)有一函数: 当x<1时,y=x 当1<=x<10时,y=2x-1 当x>=10时,y=3x-11 编写程序输入x,输出y的值.不同分支中使用独立的return,共三个

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

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

p268 4 宏的使用例子

摘要: #include#define ADD(x) x+xint main(){ int m=1,n=2,k=3; int sum=ADD(m+n)*k; printf("%d",sum);}//10 #include#define ADD(x) x+xint ma... 阅读全文

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

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

摘要: #includeint main(void){int year,month,days=0,day,flag,sum=0;int i=1;scanf("%d",&year);scanf("%d",&month);scanf("%d",&day);if(year%... 阅读全文

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

(第2种)编写一个程序,其有宏定义FUN(x),可用于计算x*2+x*2+x*2,实现从键盘输入一个实数a,输出FUN(a),FUN(a+1),FUN(a)*2的值。

摘要: #include#define FUN(x) x*2+x*2+x*2 //补充宏定义内容void main(void){ int a; scanf("%d", &a); printf("%d\n", FUN(a)); printf("... 阅读全文

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

编写一个结构体数组查找函数find,若找到则输出该结构体变量,否则输出未找到。

摘要: #include #include typedef struct { int num; char name[20]; int score;} stu;int find(stu list[], int list_len, char *find_... 阅读全文

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

(2种)编写一个函数funchar(char *a,char *b,char *c)实现如下功能:将在第一个字符串中出现的但在第二个字符串未出现的字符放在第三个字符串中,函数返回第三个字符串的长度。

摘要: #include#includetypedef struct zimu{ char a[32]; char b[32]; char c[32];}str;int main(){ int i,k=0,j,t=0; str x={0}; scanf("%s",&x... 阅读全文

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

编写一个程序,其有宏定义FUN(x),可用于计算x*2+x*2+x*2,实现从键盘输入一个实数a,输出FUN(a),FUN(a+1),FUN(a)*2的值。

摘要: #include#define FUN(x) x*2+x*2+x*2int main(){ int a,b,c; scanf("%d",&a); b=a+1;c=FUN(a); printf("%d\n",FUN(a)); printf("%d\n",FUN(... 阅读全文

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

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 32 下一页
 
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3