当前位置:网站首页>[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;
}边栏推荐
- [material delivery UAV] record (ROS + Px4 + yolov5 + esp8266 + steering gear)
- 9. Delay queue
- String, array, generalized table (detailed)
- SQL time fuzzy query datediff() function
- Integration of Nan causes in pytorch training model
- Don't insist on 66 days. Weight generates random numbers
- 不会就坚持64天吧 查找插入位置
- 14. Haproxy+kept load balancing and high availability
- Implementation of jump connection of RESNET (pytorch)
- 10. Fallback message
猜你喜欢

Hengxing Ketong invites you to the 24th China expressway informatization conference and technical product exhibition in Hunan

C language force buckle question 61 of the rotating list. Double ended queue and construction of circular linked list

TypeError: Cannot read properties of undefined (reading ‘then‘)

Whole house WiFi solution: mesh router networking and ac+ap

WebRTC实现简单音视频通话功能

论pyscript使用感想(实现office预览)

使用容器部署Jenkins

15.federation

读懂 互联网巨头 【中台之战】 以及 中台 发展思维

Update learning materials daily
随机推荐
TypeError: Cannot read properties of undefined (reading ‘then‘)
不会就坚持60天吧 神奇的字典
C language: structure simple syntax summary
Beginner: array & String
Coding questions encountered in the interview
I++ and ++i details
DASCTF2022.07赋能赛
Not for 58 days. Implement prefix tree
Machine vision Series 2: vs DLL debugging
pyscript无法引入包
VScode 一键编译和调试
Niuke IOI weekly 27 popularity group
C语言:浅谈各种复杂的声明
It won't last for 65 days. It only appears once
不会就坚持58天吧 实现前缀树
Deploy Jenkins using containers
使用容器部署Jenkins
MySQL - 深入解析MySQL索引数据结构
通过js来实现一元二次方程的效果,输入a,b,c系数后可计算出x1和x2的值
redux快速上手