当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- How to solve the conflict when JD landed on Devops platform?
- 喜获蚂蚁offer,定级p7,面经分享,万字长文带你走完面试全过程
- Implementation of verification code recognition in Python opencv pytesseract
- svg究竟是什么?
- Why is Schnorr Signature known as the biggest technology update after bitcoin segwit
- 2035 we will build such a country
- LeanCloud 十月变化
- Golang ICMP Protocol detects viable hosts
- Python基础语法
- 2020-11-05
猜你喜欢

The birth of a new integrated memory and computing chip is conducive to the application of artificial intelligence~

京东落地DevOps平台时爆发的冲突如何解决?
![[Python 1-6] Python tutorial 1 -- number](/img/3b/00bc81122d330c9d59909994e61027.jpg)
[Python 1-6] Python tutorial 1 -- number

Python基础语法

. net large data concurrency solution

Flink从入门到真香(3、从集合和文件中读取数据)

2035 we will build such a country

The first open source Chinese Bert pre training model in the financial field

How to write a resume and project

Suitable for C / C + + novice learning some projects, do not give me to miss!
随机推荐
python基础教程python opencv pytesseract 验证码识别的实现
10 common software architecture patterns
Essential for back-end programmers: distributed transaction Basics
Flink: from introduction to Zhenxiang (6. Flink implements UDF function - realizes more fine-grained control flow)
Q & A and book giving activities of harbor project experts
我们做了一个医疗版MNIST数据集,发现常见AutoML算法没那么好用
Golang ICMP Protocol detects viable hosts
原创 | 数据资产确权浅议
浅谈,盘点历史上有哪些著名的电脑病毒,80%的人都不知道!
Summary of template engine
On DSA of OpenGL
wanxin finance
金融领域首个开源中文BERT预训练模型,熵简科技推出FinBERT 1.0
The network adapter could not establish the connection
关于update操作并发问题
RestfulApi 学习笔记——父子资源(四)
I used Python to find out all the people who deleted my wechat and deleted them automatically
优化if-else代码的八种方案
LeanCloud 十月变化
.NET 大数据量并发解决方案