当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Major changes in Huawei's cloud: Cloud & AI rises to Huawei's fourth largest BG with full fire
- 数据库连接报错之IO异常(The Network Adapter could not establish the connection)
- 大龄程序员没有出路吗?
- C++的那些事儿:从电饭煲到火箭,C++无处不在
- Dev-c++在windows环境下无法debug(调试)的解决方案
- 构建者模式(Builder pattern)
- Recurrence of Apache kylin Remote Code Execution Vulnerability (cve-2020-1956)
- 技术总监7年总结,如何进行正确的沟通?
- Introduction to mongodb foundation of distributed document storage database
- Golang 系统ping程序探测存活主机(任意权限)
猜你喜欢

rabbitmq(一)-基础入门

大龄程序员没有出路吗?

Share the experience of passing the PMP examination

Flink: from introduction to Zhenxiang (6. Flink implements UDF function - realizes more fine-grained control flow)

Talking about, check the history of which famous computer viruses, 80% of the people do not know!

Essential for back-end programmers: distributed transaction Basics

优化if-else代码的八种方案

Python基础语法

Powershell 使用.Net对象发送邮件

Introduction to mongodb foundation of distributed document storage database
随机推荐
Gopherchina 2020 Conference
2035 we will build such a country
LeanCloud 十月变化
CSP考试须知与各种小技巧
Why is Schnorr Signature known as the biggest technology update after bitcoin segwit
小青台正式踏上不归路的第3天
大龄程序员没有出路吗?
我用 Python 找出了删除我微信的所有人并将他们自动化删除了
2020-11-05
擅长To C的腾讯,如何借腾讯云在这几个行业云市场占有率第一?
【Python 1-6】Python教程之——数字
AQS analysis
Q & A and book giving activities of harbor project experts
优化if-else代码的八种方案
Huawei has an absolute advantage in the 5g mobile phone market, and the market share of Xiaomi is divided by the market survey organization
浅谈OpenGL之DSA
阿里云的MaxCompute数加(原ODPS)用的怎样?
nat转换的ip跟端口ip不相同的解决方法
Introduction to mongodb foundation of distributed document storage database
Flink从入门到真香(7、Sink数据输出-文件)