Kamis, 19 Januari 2012

konfersi temperature

Here is an example program konfersi temperatures with Turbo Basic
cls

input "Enter a temperature that will dikonfersi:"; temperature

input "Enter the unit of origin (C / F / R):"; from $

input "Enter the destination unit (C / F / R):"; go $

if the origin $ = "c" or origin $ = "C" then

if heading $ = "F" or go $ = "f" then

result = 9 / 5 * temperatures +32

print "Results from"; temperature; "degrees"; from $; "is"; results; "degrees"; go $

else

result = 4 / 5 * temperature

print "Results from"; temperature; "degrees"; from $; "is"; results; "degrees"; go $

end if

end if

if the origin $ = "f" or origin $ = "F" then

if heading $ = "c" or go $ = "C" then

result = 5 / 9 * the temperature of +32

print "Results from"; temperature; "degrees"; from $; "is"; results; "degrees"; go $

else

result = 4 / 9 * temperature

print "Results from"; temperature; "degrees"; from $; "is"; results; "degrees"; go $

end if

end if

if the origin $ = "r" or origin $ = "R" then

if heading $ = "F" or go $ = "f" then

result = 9 / 4 * temperatures +32

print "Results from"; temperature; "degrees"; from $; "is"; results; "degrees"; go $

else

result = 5 / 4 * temperature

print "Results from"; temperature; "degrees"; from $; "is"; results; "degrees"; go $

end if

end if

Tidak ada komentar: