-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcode.html
97 lines (84 loc) · 2.8 KB
/
code.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<head>
<title>
Temperature Conversion
</title>
<style>
body { text-align: left;background-color: rgba(0,0,100,0.25); }
</style>
</head>
<body>
<section style="text-align: center;font-size: 150%;background-image: url(https://i.ytimg.com/vi/KFNxdXEe0Ko/maxresdefault.jpg);color: white;">
<p><strong><br><br>Problem Statement: <br>Write a code in any programming language that converts
Centigrade to Fahrenheit.<br><br></strong></p>
</section>
<hr>
<section>
<h4>Code to convert temperature from <sup>0</sup>C to <sup>0</sup>F:</h4>
<kbd>C++ Implementation:</kbd>
<pre>
<code style="background-color: rgba(50,50,100,0.50);">
#include < iostream>
using namespace std;
int main()
{
float celsius;
// taking input in degree celsius
cout << "Enter the temperature in <sup>0</sup>C: ";
cin >> celsius;
// calculating fahrenheit
float fahrenheit = (celsius * 1.8) + 32;
// printing fahrenheit
cout << "The temperature is " << fahrenheit << "<sup>0</sup>F";
return 0;
}
</code>
</pre>
</section>
<hr>
<section style="background-color: rgba(50,50,100,0.50);">
<h3>General Formula:</h3>
<p><var><sup>0</sup>fahrenheit=(<sup>0</sup>celsius*1.8)+32</var></p>
</section>
<hr>
<section style="background-color: rgba(50,50,100,0.50);">
<h3>Sample Input:</h3>
<samp>Enter the temperature in <sup>0</sup>C: 9</samp>
</section>
<hr>
<section style="background-color: rgba(50,50,100,0.50);">
<h3>Sample Output:</h3>
<samp>The temperature is 41<sup>0</sup>F </samp>
</section>
<hr>
<section style="background-color: rgba(50,50,100,0.50);">
<h3>Time complexity:</h3>
<p>O(1)</p>
<h3>Space complexity:</h3>
<p>O(1)</p>
</section>
<hr>
<section style="text-align: center;background-color: rgba(50,50,100,0.50);">
<h2>References:</h2>
<nav>
<a href="https://www.w3resource.com/c-programming-exercises/input-output/c-input-output-statement-exercises-1.php">w3resource</a> |
<a href="https://spiderlabweb.com/cpp-program-convert-temperature-celsius-fahrenheit/">spiderlabweb</a> |
<a href="https://www.codevscolor.com/c-plus-plus-celsius-fahrenheit-conversion">codevscolor</a> |
<a href="https://codescracker.com/c/program/c-program-convert-centigrade-to-fahrenheit.htm">codescracker</a>
</nav>
</section>
<hr>
<article style="background-color: rgba(50,50,100,0.50);text-align: center;">
<footer>
<address>
<strong>This code is contributed by:</strong><br> <a href="mailto:[email protected]">Shivani Avasare</a>.<br>
<strong>Visit us at:</strong><br>
Walchand College Of Engineering,Sangli</strong><br>
Maharashtra,<br>
India.
</address>
</footer>
</article>
</body>
</html>