当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- AI周报:允许“员工自愿降薪”;公司回应:员工内心高兴满意;虎牙HR将员工抬出公司;瑞典禁用华为中兴5G设备
- Talking about, check the history of which famous computer viruses, 80% of the people do not know!
- I used Python to find out all the people who deleted my wechat and deleted them automatically
- We made a medical version of the MNIST dataset, and found that the common automl algorithm is not so easy to use
- 金融领域首个开源中文BERT预训练模型,熵简科技推出FinBERT 1.0
- LeanCloud 十月变化
- 后端程序员必备:分布式事务基础篇
- What is the database paradigm
- 喝汽水,1瓶汽水1元,2个空瓶可以换一瓶汽水,给20元,可以多少汽水
- 阿里撕下电商标签
猜你喜欢
Examples of unconventional aggregation
后端程序员必备:分布式事务基础篇
Arduino IDE搭建ESP8266开发环境,文件下载过慢解决方法 | ESP-01制作WiFi开关教程,改造宿舍灯
Flink从入门到真香(3、从集合和文件中读取数据)
C++的那些事儿:从电饭煲到火箭,C++无处不在
Or talk No.19 | Facebook Dr. Tian Yuandong: black box optimization of hidden action set based on Monte Carlo tree search
3、 The parameters of the function
How to cooperate with people in software development? |Daily anecdotes
.NET 大数据量并发解决方案
Flink从入门到真香(10、Sink数据输出-Elasticsearch)
随机推荐
Flink from introduction to Zhenxiang (10. Sink data output elasticsearch)
一文剖析2020年最火十大物联网应用|IoT Analytics 年度重磅报告出炉!
Examples of unconventional aggregation
laravel8更新之维护模式改进
Interpretation of deepmind's latest paper: the causal reasoning algorithm in discrete probability tree is proposed for the first time
我们做了一个医疗版MNIST数据集,发现常见AutoML算法没那么好用
Flink: from introduction to Zhenxiang (6. Flink implements UDF function - realizes more fine-grained control flow)
Suitable for C / C + + novice learning some projects, do not give me to miss!
刚刚好,才是最理想的状态
应届生年薪35w+ !倒挂老员工,互联网大厂薪资为何越来越高?
华为在5G手机市场占据绝对优势,市调机构对小米的市占出现分歧
The progress bar written in Python is so wonderful~
Tencent, which is good at to C, how to take advantage of Tencent's cloud market share in these industries?
It's just right. It's the ideal state
三、函数的参数
Golang ICMP协议探测存活主机
阿里云视频云技术专家 LVS 演讲全文:《“云端一体”的智能媒体生产制作演进之路》
On monotonous stack
[Python 1-6] Python tutorial 1 -- number
Builder pattern