{"id":192802,"date":"2025-02-18T08:57:39","date_gmt":"2025-02-18T08:57:39","guid":{"rendered":"https:\/\/learnexams.com\/blog\/?p=192802"},"modified":"2025-02-18T08:57:42","modified_gmt":"2025-02-18T08:57:42","slug":"c-program-for-the-temperature-measurements-in-celsius-are-35-2-26-3-34-78-19-34-33-7","status":"publish","type":"post","link":"https:\/\/www.learnexams.com\/blog\/2025\/02\/18\/c-program-for-the-temperature-measurements-in-celsius-are-35-2-26-3-34-78-19-34-33-7\/","title":{"rendered":"C++ program for: The temperature measurements in Celsius are: 35.2 26.3 34.78 19.34 33.7"},"content":{"rendered":"\n<p>C++ program for: The temperature measurements in Celsius are: 35.2 26.3 34.78 19.34 33.7 The temperature measurements in Fahrenheit are: 95.36 79.34 94.604 66.812 92.66<\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-ast-global-color-6-color\"><strong>The Correct Answer and Explanation is :<\/strong><\/mark><\/p>\n\n\n\n<p>Below is a C++ program that converts the given temperature measurements in Celsius to Fahrenheit and compares the results with the given Fahrenheit measurements.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream&gt;\n#include &lt;iomanip&gt; \/\/ For setting decimal precision\n\nusing namespace std;\n\nint main() {\n    \/\/ Array of temperature measurements in Celsius\n    double celsius&#91;] = {35.2, 26.3, 34.78, 19.34, 33.7};\n\n    \/\/ Array of temperature measurements in Fahrenheit\n    double fahrenheit&#91;] = {95.36, 79.34, 94.604, 66.812, 92.66};\n\n    \/\/ Calculate and display the corresponding Fahrenheit values\n    cout &lt;&lt; fixed &lt;&lt; setprecision(2);  \/\/ Set decimal precision to 2 places\n    cout &lt;&lt; \"Celsius to Fahrenheit Conversion:\\n\";\n    for (int i = 0; i &lt; 5; i++) {\n        double calculatedFahrenheit = (celsius&#91;i] * 9\/5) + 32;  \/\/ Celsius to Fahrenheit formula\n        cout &lt;&lt; \"Celsius: \" &lt;&lt; celsius&#91;i] &lt;&lt; \" -&gt; Calculated Fahrenheit: \" &lt;&lt; calculatedFahrenheit;\n        cout &lt;&lt; \" | Given Fahrenheit: \" &lt;&lt; fahrenheit&#91;i] &lt;&lt; endl;\n    }\n\n    return 0;\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Explanation:<\/h3>\n\n\n\n<p>In this program, we have two arrays:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>celsius[]<\/code>: Contains the given temperature values in Celsius.<\/li>\n\n\n\n<li><code>fahrenheit[]<\/code>: Contains the given temperature values in Fahrenheit.<\/li>\n<\/ol>\n\n\n\n<p>The goal of the program is to:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Convert the Celsius temperatures into Fahrenheit using the formula:<br>[<br>F = \\frac{9}{5} \\times C + 32<br>]<br>where:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>( F ) is the temperature in Fahrenheit.<\/li>\n\n\n\n<li>( C ) is the temperature in Celsius.<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Display both the calculated Fahrenheit values (from Celsius) and the given Fahrenheit values for comparison.<\/li>\n<\/ol>\n\n\n\n<p>The program iterates through the arrays, calculates the Fahrenheit temperature for each Celsius value, and outputs both the calculated and given Fahrenheit temperatures.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Output Example:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Celsius to Fahrenheit Conversion:\nCelsius: 35.20 -&gt; Calculated Fahrenheit: 95.36 | Given Fahrenheit: 95.36\nCelsius: 26.30 -&gt; Calculated Fahrenheit: 79.34 | Given Fahrenheit: 79.34\nCelsius: 34.78 -&gt; Calculated Fahrenheit: 94.60 | Given Fahrenheit: 94.60\nCelsius: 19.34 -&gt; Calculated Fahrenheit: 66.81 | Given Fahrenheit: 66.81\nCelsius: 33.70 -&gt; Calculated Fahrenheit: 92.66 | Given Fahrenheit: 92.66<\/code><\/pre>\n\n\n\n<p>This program demonstrates how to use a mathematical formula to convert between temperature scales. The Fahrenheit and Celsius scales are linearly related, with Fahrenheit increasing faster than Celsius due to the multiplication by 9\/5.<\/p>\n\n\n\n<p>I will now generate an image to help visualize this.<\/p>\n\n\n\n<p>Here is the digital illustration showing the concept of temperature conversion between Celsius and Fahrenheit. It also includes the conversion formula to help visualize the relationship between the two scales. Let me know if you need further clarification or adjustments!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/learnexams.com\/blog\/wp-content\/uploads\/2025\/02\/image-923.png\" alt=\"\" class=\"wp-image-192803\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>C++ program for: The temperature measurements in Celsius are: 35.2 26.3 34.78 19.34 33.7 The temperature measurements in Fahrenheit are: 95.36 79.34 94.604 66.812 92.66 The Correct Answer and Explanation is : Below is a C++ program that converts the given temperature measurements in Celsius to Fahrenheit and compares the results with the given Fahrenheit [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[25],"tags":[],"class_list":["post-192802","post","type-post","status-publish","format-standard","hentry","category-exams-certification"],"_links":{"self":[{"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/posts\/192802","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/comments?post=192802"}],"version-history":[{"count":0,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/posts\/192802\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/media?parent=192802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/categories?post=192802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/tags?post=192802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}