当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Python basic syntax
- Station B STM32 video learning
- Improvement of rate limit for laravel8 update
- Comics: looking for the best time to buy and sell stocks
- Welcome to offer, grade P7, face-to-face sharing, 10000 words long text to take you through the interview process
- Flink from introduction to Zhenxiang (10. Sink data output elasticsearch)
- 阿里云的MaxCompute数加(原ODPS)用的怎样?
- Powershell 使用.Net对象发送邮件
- 优化if-else代码的八种方案
- Tips and skills of CSP examination
猜你喜欢
适合c/c++新手学习的一些项目,别给我错过了!
Get PMP certificate at 51CTO College
The progress bar written in Python is so wonderful~
我用 Python 找出了删除我微信的所有人并将他们自动化删除了
Flink从入门到真香(10、Sink数据输出-Elasticsearch)
Python basic syntax
小米、OPPO在欧洲市场继续飙涨,小米更是直逼苹果
学习记录并且简单分析
技术总监7年总结,如何进行正确的沟通?
Build simple business monitoring Kanban based on Alibaba cloud log service
随机推荐
Blockchain weekly: the development of digital currency is written into the 14th five year plan; Biden invited senior adviser of MIT digital currency program to join the presidential transition team; V
Enabling education innovation and reconstruction with science and technology Huawei implements education informatization
The progress bar written in Python is so wonderful~
CSP考试须知与各种小技巧
Improvement of rate limit for laravel8 update
我用 Python 找出了删除我微信的所有人并将他们自动化删除了
Tips and skills of CSP examination
阿里云视频云技术专家 LVS 演讲全文:《“云端一体”的智能媒体生产制作演进之路》
我用 Python 找出了删除我微信的所有人并将他们自动化删除了
Recurrence of Apache kylin Remote Code Execution Vulnerability (cve-2020-1956)
AI weekly: employees are allowed to voluntarily reduce salary; company response: employees are happy and satisfied; tiger tooth HR takes employees out of the company; Sweden forbids Huawei ZTE 5g equi
Elasticsearch 学习一(基础入门).
2035我们将建成这样的国家
非常规聚合问题举例
Restfulapi learning notes -- father son resources (4)
Android Basics - check box
Leancloud changes in October
Examples of unconventional aggregation
模板引擎的整理归纳
I used Python to find out all the people who deleted my wechat and deleted them automatically