![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c语言作业
这是我的月抛昵称
学会学习
展开
-
2021-12-11
#include<stdio.h>int fenglei(int a){if (a >= 90 && a <= 100)return 0;if (a >= 80 && a <= 89)return 1;if (a >= 70 && a <= 79)return 2;if (a >= 60 && a <= 69)return 3;if (a >= 0 &&a.原创 2021-12-16 08:47:09 · 753 阅读 · 1 评论 -
《第39级台阶》2021-11-26
There is someone to climb 39 steps. Each step can only take 1 or 2 steps. Take the left foot first, then alternate left and right, and the last step is to take the right foot, that is to say, take an even number of steps. Write a recursive function to outp原创 2021-11-26 21:57:39 · 167 阅读 · 0 评论 -
利用静态变量计算n的阶乘2021-11-23
利用静态变量计算n的阶乘。 **输入格式要求:"%d" 提示信息:"Input n:" **输出格式要求:"%d! = %ld\n" 程序运行示例如下: Input n:10 1! = 1 2! = 2 3! = 6 4! = 24 5! = 120 6! = 720 7! = 5040 8! = 40320 9! = 362880 10! = 3628800#include<stdio.h>static int i = 0, sum = 1;long jiecheng(void).原创 2021-11-23 23:04:59 · 446 阅读 · 0 评论 -
回文数的形成。任取一个十进制整数,将其倒过来后与原来的整数相加,得到一个新的整数后,重复以上步骤,最终可得到一个回文数,请编程验证。2021-10-29
回文数的形成。任取一个十进制整数,将其倒过来后与原来的整数相加,得到一个新的整数后,重复以上步骤,最终可得到一个回文数,请编程验证。**输入格式要求:"%ld" 提示信息:"please enter a number optionaly:" "The generation process of palindrome:\n" " input error, break.\n" **输出格式要求:" [%d]: %ld+%ld=%ld\n" "Here we reached the aim a.原创 2021-10-27 09:59:14 · 2368 阅读 · 0 评论 -
在主函数中从键盘输入某班学生某门课程的成绩(已知班级人数最多不超过40人,具体人数由键盘输入),试编程计算其平均分,并计算出成绩高于平均分的学生的人数。2021-10-31
要求:调用函数aver(),计算n名学生的平均成绩返回给主函数,然后在主函数中输出学生的平均成绩。函数原型:float aver(int score[],int n);***输入提示信息:无***输入格式:输入学生人数用"%d",输入学生成绩用"%d"***输出平均成绩提示信息和格式:"Average score is %10.2f\n"***输出平均分以上的学生人数提示信息和格式:"The number of students in more than average %d\n"注:(1)不.原创 2021-10-30 13:16:08 · 8079 阅读 · 0 评论 -
c语言作业——打印一年的日历
#include<stdio.h>int judge(int year)//闰年判断器{ if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) return 1; else return 0;}int days(int year, int month)//该月天数{ if (month == 4 || month == 6 || month == 9 || month == 11) return.原创 2021-11-06 15:09:03 · 389 阅读 · 0 评论 -
循环实现图案
打印出以下图案:(注:用循环实现,直接输出不仅不得分,反而会被系统判为“作弊”。) * * * * * * * * * * * * * * * * .原创 2021-11-10 17:47:19 · 1584 阅读 · 0 评论 -
2021-11-11出生开始到目前为止的生命中已有的心跳总数-c语言
假设人的心率为每分钟跳75下,编程从键盘输入你的出生年和今年的年份,然后以年为单位计算并输出从你出生开始到目前为止的生命中已有的心跳总数(要求考虑闰年)。输入提示信息:"Input your birth year:","Input this year:"输入格式:%d输出提示信息和输出格式:"The heart beats in your life: %lu"程序运行结果示例:Input your birth year: 1986↙Input this year:2016↙The he...原创 2021-11-11 21:22:13 · 1622 阅读 · 0 评论 -
从键盘任意输入一个整数m,若m不是素数,则对m进行质因数分解,并将m表示为质因数从小到大顺序排列的乘积形式输出
第7章实验任务6从键盘任意输入一个整数m,若m不是素数,则对m进行质因数分解,并将m表示为质因数从小到大顺序排列的乘积形式输出,否则输出"It is a prime number"。例如,用户输入90时,程序输出90 = 2 * 3 * 3 * 5;用户输入17时,程序输出"It is a prime number"。#include<stdio.h>int judge(int);void output(int a)//void 可以使用return; exit();结束函.原创 2021-11-18 00:06:24 · 3904 阅读 · 0 评论 -
定义函数Gcd计算两个整数的最大公约数
定义函数Gcd计算两个整数的最大公约数,如果输入的数不是正整数,则返回-1。然后再在主函数中调用该函数,数据的输入输出在主函数中完成。 **主函数中输入提示信息格式要求:"Input a,b:" 主函数中输入格式:"%d,%d" **主函数中输出提示信息要求: 如果输入的数不是正整数,则输出"Input number should be positive!\n",否则按如下格式输出"Greatest Common Divisor of %d and %d is .原创 2021-11-19 11:57:27 · 5844 阅读 · 0 评论