Fahrenheit to Celsius Table in C++
Fahrenheit to Celsius Table
Send Feedback
Fahrenheit to Celsius Table
3 integers - S, E and W respectively
Fahrenheit to Celsius conversion table. One line for every Fahrenheit and corresponding Celsius value in integer form. The Fahrenheit value and its corresponding Celsius value should be separate by single space.
0 <= S <= 90
S <= E <= 900
0 <= W <= 80
0
100
20
0 -17
20 -6
40 4
60 15
80 26
100 37
20
119
13
20 -6
33 0
46 7
59 15
72 22
85 29
98 36
111 43
Start calculating the Celsius values for each Fahrenheit Value which starts from 20. So starting from 20, we need to compute its corresponding Celsius value which computes to -6. We print this information as <Fahrenheit Value> <a single space> <Celsius Value> on each line. Now add 13 to Fahrenheit Value at each step until you reach 119 in this case. You may or may not exactly land on the end value depending on the steps you are taking.
// #include<iostream>// using namespace std;
// int main(){
// /* Read input as specified in the question.// * Print output as specified in the question.// */// int S,W,E;// cin>>S>>E>>W; // while(E>S){// int f=(S-32)*5/9;// cout<<S<<"\t"<<f<<endl;// S=S+W; // } // }
#include<iostream>using namespace std;
int main(){ int s,e,w,tot; cin>>s>>e>>w; for(int i=s;i<=e;i+=w){ tot=(i-32)/1.8; cout<<i<<"\t"<<tot<<endl; }// int s,e,w,i,cd;// cin>>s;// cin>>e;// cin>>w; // for(i=s;i<=e;i+=w)// {// cd=(i-32)/1.8;// cout<<i<<"\t"<<cd<<"\n";// } }
Comments
Post a Comment