Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Good day people.
I'm really new to C#.
I can't find the solution to the following question in my textbook:

Write a C# console program that converts temperature in degrees Celsius to degrees
Fahrenheit. Show all values from –40 degrees Celsius to +40 degrees Celsius in steps
of 5 degrees. For example, your output should show –40, –35, –30, –25 and so on, up
to +40 degrees Celsius.

For each value shown in degrees Celsius, your program is required to calculate the
equivalent temperature in degrees Fahrenheit using the following formula:
f = (9.0/5.0) * c + 32, where 'c' is the temperature in Celsius and 'f' is the
temperature in Fahrenheit.

The program must use a for loop.

I have no idea how to start.
Please help.

What I have tried:

I have tried looking on google for a solution but I haven't found a program that uses a for loop.

Please guys, your help is much appreciated.
Posted
Updated 30-Jan-18 8:35am

C#
for (int c = -40; c <= 40; c += 5)
{
    // Conversion code here...
}

for (C# Reference) | Microsoft Docs[^]
 
Share this answer
 
Have you tried looking in the appendix?
All good textbooks have the answers included.
 
Share this answer
 
Comments
Member 13652359 31-Jan-18 5:42am    
It's an Assignment question.
pt1401 31-Jan-18 5:54am    
On course it is, which is why I suggested he look in his textbook.
If the textbook even exists, the question won't be in it. Neither will the answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900