Temperature!

This post is about a program that ask for a temperature in degrees Celsius and outputs its equivalent in degrees Fahrenheit. Then, the program tells if water boils or not at that given temperature.

I got help form a friend, google and the book. It was easy, the only new concept we needed to complete this task was the conditional “if”. Take a look to my code:

04 Temperature

Again we had to ask for an initial value, then do some basic math and print the result.

The cool thing was using “IF”. As it’s shown in the picture, “if” allows the program to execute a certain part of the code if a condition is met. In this case the condition was simple, if the initial temperature in degrees Celsius is greater than 100, then print “Water boils at this temperature”. Then I used another function called “else”, it’s pretty obvious how it works… for any other case that does not satisfies the “if” condition, do whatever is after the “else”.

The end.

The End CC licensed phto by Chris Lofqvist on Flickr
The End CC licensed phto by Chris Lofqvist on Flickr

CC BY 4.0 WSQ05 by Octavio Rojas is licensed under a Creative Commons Attribution 4.0 International License.