当前位置:网站首页>[c language] PTA 7-50 output Fahrenheit Celsius temperature conversion table
[c language] PTA 7-50 output Fahrenheit Celsius temperature conversion table
2022-07-29 04:29:00 【LastWhisperw】
Input 2 A positive integer lower and upper(lower≤upper≤100), Please output one with the value range of [lower,upper]、 And increase every time 2 Fahrenheit in degrees Fahrenheit - Centigrade temperature conversion meter .
The calculation formula of temperature conversion :C=5×(F−32)/9, among :C It means the temperature in centigrade ,F Fahrenheit temperature .
Input format :
Enter... In one line 2 It's an integer , respectively lower and upper Value , Separate... With spaces in the middle .
Output format :
The first line outputs :"fahr celsius"
And then one Fahrenheit per line fahr( integer ) With a centigrade temperature celsius( occupy 6 Character width , Align right , Retain 1 Decimal place ).
If the input range is illegal , The output "Invalid.".
sample input 1:
32 35No blank lines at the end
sample output 1:
fahr celsius
32 0.0
34 1.1No blank lines at the end
sample input 2:
40 30sample output 2:
Invalid.Nothing special , Just need to know how many characters it takes %m.nf Represents the occupation of a real number m position , among n Place is a decimal .
#include<stdio.h>
int main(){
int l,r;
scanf("%d %d",&l,&r);
float c;
if(l>r || l>100 ||r>100){
printf("Invalid.");
}else{
printf("fahr celsius");
while(l<=r){
c=5*(l-32)/9.0;
printf("\n%d %5.1f",l,c);
l+=2;
}
}
return 0;
}边栏推荐
- 论pyscript使用感想(实现office预览)
- MySQL - clustered index and secondary index
- C语言:联合体知识点总结
- C language: talking about various complex statements
- Exception resolution: error of not finding edu.stanford.nlp.semgraph.semgrex.semgrexpattern in cococaption package
- Oracle insert data
- Can you really write restful API?
- oracle 更新和删除数据
- [k210 stepping pit] pytorch model is converted to kmodel and used on dock. (ultimately not achieved)
- 不会就坚持70天吧 数组中第k大的数
猜你喜欢

Unity基础(3)—— unity中的各种坐标系

MySQL - 深入解析MySQL索引数据结构

11.备份交换机

14. Haproxy+kept load balancing and high availability

恒星科通邀您“湘”约第24届中国高速公路信息化大会暨技术产品展示会

9. Delay queue

MySQL - 聚簇索引和辅助索引

10.回退消息
![[hands on deep learning] environment configuration (detailed records, starting from the installation of VMware virtual machine)](/img/fe/8c707c30c734de7bb76ea68134842c.png)
[hands on deep learning] environment configuration (detailed records, starting from the installation of VMware virtual machine)

Class starts! See how smardaten decomposes complex business scenarios
随机推荐
15.federation
leetcode 686.重复叠加字符串 KMP方法(C语言实现)
Labelme cannot open the picture
14.haproxy+keepalived负载均衡和高可用
Class starts! See how smardaten decomposes complex business scenarios
JVM (heap and stack) memory allocation
Post export data, return
论pyscript使用感想(实现office预览)
10. Fallback message
The principle of inverse Fourier transform (IFFT) in signal processing
redux快速上手
不会就坚持71天吧 链表排序
C language: structure simple syntax summary
11. Backup switch
不会就坚持67天吧 平方根
【Express连接MySQL数据库】
Not 67 days, square root
Exception handling: pyemd or pyemd not found
It won't last for 65 days. It only appears once
TypeError: Cannot read properties of undefined (reading ‘then‘)