当前位置:网站首页>Chapter 5 programming
Chapter 5 programming
2020-11-08 15:22:00 【Raspberry 201 Yang Feifan 202005018130】
5.1 ### Time shift Seconds to minutes
#include<stdio.h>
#define p 60
void main()
{
int a, b;
printf(" Enter time seconds =");
scanf_s("%d", &a);
while (a > 0)
{
printf("%d second =%d Hours %d second \n", a, a / p, a % p);
printf(" Enter time seconds =");
scanf_s("%d", &a);
}
}
5.2
Output the input number according to the size to Digital plus 10
#include<stdio.h>
void main()
{
int a, b;
printf(" Enter the number you want : ");
scanf_s("%d", &a);
b = a;
while (b <= a + 10)
{
printf("%d\n", b);
b++;
}
}
5.3
Week shift
#include<stdio.h>
void main()
{
int a, b, c;
printf(" Enter the number of days :");
scanf_s("%d", &a);
while (a > 0)
{
printf("%d God =%d Zhou %d God \n", a, a / 7, a % 7);
printf(" Enter the number of days :");
scanf_s("%d",& a);
}
}
5.4
Height shift
#include<stdio.h>
void main()
{
float a;
printf(" Enter your height :");
scanf_s("%f", &a);
for (; a > 0;)
{
printf("%.0fcm=%.2f feet %.2f Inch \n", a, a / 30.48, a / 2.54);
printf(" Enter your height :");
scanf_s("%d", &a);
}
}
5.5
Making money calculation
#include<stdio.h>
void main()
{
int a, b;
printf(" Input The money you make in a day :\n");
scanf_s("%d", &a);
printf(" Enter the number of days :\n");
scanf_s("%d", &b);
printf(" I've made a lot of money %d element ", a * b);
}
5.6
improvement 5.5
void main()
{
int b, qian, c;
qian = 0;
printf(" Enter the number of days :\n");
scanf_s("%d", &b);
for (c = 1; c <= b; c++)
{
qian = c * c;
printf(" The first %d God earned %d\n", c, c * c);
}
}
5.8 Mod
#include<stdio.h>
void main()
{
int a, b, c;
printf(" Enter the number of fish :\n");
scanf_s("%d", &a);
printf(" Input the number of fish \n");
scanf_s("%d", &b);
printf(" Now the number of fish is :\n", b);
printf("%d more than %d =%d\n", b,a,b%a);
for (; b > 0;)
{
printf(" Input the number of fish \n");
scanf_s("%d", &b);
printf(" Now the number of fish is :\n",b );
printf("%d more than %d =%d\n", b, a, b % a);
}
}
5.9
Temperature conversion
#include<stdio.h>
void main()
{
double a;
printf(" Enter the temperature Fahrenheit =");
scanf_s("%lf", &a);
printf(" The temperature in centigrade is =%.2lf \n Show the temperature =%.2lf\n", (a - 32) * 5.0 / 9.0, a + 273.16);
while (a > 0 || a <= 0)
{
printf(" Enter the temperature Fahrenheit =\n");
scanf_s("%lf", &a);
printf(" The temperature in centigrade is =%.2lf \n Show the temperature =%.2lf\n", (a - 32) * 5 / 9.0, a + 273.16);
}
}
/5.9 problem It should be confirmed that the input value is double Even if the input is not a number It's also stored in numbers I don't know how to guarantee When the input is a letter Make sure the program exits correctly / Once you enter a non numeric program, it goes wrong And it can't stop Orz
版权声明
本文为[Raspberry 201 Yang Feifan 202005018130]所创,转载请带上原文链接,感谢
边栏推荐
- laravel8更新之速率限制改进
- 2035 we will build such a country
- On monotonous stack
- Rust: performance test criteria Library
- Learn to record and analyze
- Enabling education innovation and reconstruction with science and technology Huawei implements education informatization
- 区块链周报:数字货币发展写入十四五规划;拜登邀请MIT数字货币计划高级顾问加入总统过渡团队;委内瑞拉推出国营加密交易所
- Tight supply! Apple's iPhone 12 power chip capacity exposed
- 我用 Python 找出了删除我微信的所有人并将他们自动化删除了
- C++的那些事儿:从电饭煲到火箭,C++无处不在
猜你喜欢
Tips and skills of CSP examination
Tight supply! Apple's iPhone 12 power chip capacity exposed
阿里云加速增长,进一步巩固领先优势
Improvement of rate limit for laravel8 update
软件开发中如何与人协作? | 每日趣闻
我们做了一个医疗版MNIST数据集,发现常见AutoML算法没那么好用
关于update操作并发问题
Build simple business monitoring Kanban based on Alibaba cloud log service
Learn to record and analyze
Powershell 使用.Net对象发送邮件
随机推荐
京东落地DevOps平台时爆发的冲突如何解决?
Share the experience of passing the PMP examination
Build simple business monitoring Kanban based on Alibaba cloud log service
Golang system ping program to detect the surviving host (any permission)
浅谈单调栈
rabbitmq(一)-基础入门
Gopherchina 2020 Conference
阿里云视频云技术专家 LVS 演讲全文:《“云端一体”的智能媒体生产制作演进之路》
Learn to record and analyze
Tips and skills of CSP examination
我用 Python 找出了删除我微信的所有人并将他们自动化删除了
Stm32uberide download and install - GPIO basic configuration operation - debug (based on CMSIS DAP debug)
刚刚好,才是最理想的状态
非常规聚合问题举例
这次,快手终于比抖音'快'了!
华为在5G手机市场占据绝对优势,市调机构对小米的市占出现分歧
Ali tear off the e-commerce label
喜获蚂蚁offer,定级p7,面经分享,万字长文带你走完面试全过程
.NET 大数据量并发解决方案
软件开发中如何与人协作? | 每日趣闻