当前位置:网站首页>[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;
}边栏推荐
- Multi rotor six axis hardware selection
- HC06 HC05 BT
- Don't stick to it for 68 days. Baboons eat bananas
- Actual combat of flutter - DIO of request encapsulation (II)
- Installation and use of stm32cubemx (5.3.0)
- Realize the effect of univariate quadratic equation through JS. Enter the coefficients of a, B and C to calculate the values of X1 and x2
- Post export data, return
- Understand the Internet giant [the war between China and Taiwan] and the development thinking of China and Taiwan
- (.*?) regular expression
- Log configuration logback
猜你喜欢

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

Not for 58 days. Implement prefix tree

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

On quotation

Don't insist on 66 days. Weight generates random numbers

Redux quick start

The principle of inverse Fourier transform (IFFT) in signal processing

Basic operation of queue

Idea small settings

不会就坚持65天吧 只出现一次的数字
随机推荐
C language: talking about various complex statements
C language: enumerating knowledge points summary
不会就坚持67天吧 平方根
C语言:枚举知识点总结
Sequence list and linked list
Mongo Shell交互式命令窗口
[hands on deep learning] environment configuration (detailed records, starting from the installation of VMware virtual machine)
Exception resolution: error of not finding edu.stanford.nlp.semgraph.semgrex.semgrexpattern in cococaption package
Machine vision Series 1: Visual Studio 2019 dynamic link library DLL establishment
Won't you insist on 71 days? List sorting
The principle of inverse Fourier transform (IFFT) in signal processing
通过js来实现一元二次方程的效果,输入a,b,c系数后可计算出x1和x2的值
MySQL - clustered index and secondary index
Idea small settings
VScode 一键编译和调试
15.federation
post导出数据,返回
异常解决:cococaption包出现找不到edu.stanford.nlp.semgraph.semgrex.SemgrexPattern错误
Post export data, return
Leetcode 686. KMP method of repeatedly superimposing strings (implemented in C language)