Temperature Converter

program temperature_conversion; uses crt; var c,f:real; choice:char; begin repeat write('Write F for conversion from Fahrenheit to Celsius or C for reverse: '); readln(choice); if (choice='C') or (choice='c') then begin write('Give degrees in Celsius: '); readln(c); c:=c*9/5 + 32; writeln(c:3:1); end else if (choice='F') or (choice='f') then begin write('Give degrees in Fahrenheit: '); readln(f); f:=(f-32)*5/9; writeln(f:3:1); end else break; until false; end.
Converts Fahrenheit degrees to Celsius and the other way around.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.