a sample program that coverts Fahrenheit to celcius and celcius to Fahrenheit
program Conversion;
var a: char;
Fah,f,Cel,c: real;
begin
writeln('Please Select Problem /n (f)Fahrenheit (c)Celcius');
read(a);
if a = 'f' then
begin
writeln('you have selected Fahrenheit');
writeln('please Enter Fahrenheit');
read(f);
Cel := ( 5 / 9 ) * ( f - 32);
writeln('the value in Celcius is: ');writeln(Cel);
end;
if a = 'c' then
begin
writeln('you have selected Celcius');
writeln('please Enter Celcius');
read(c);
Fah := ( 9 / 5) * (c + 32);
writeln('the value in Fahrenheit is: ');writeln(Fah);
end;
end.
Save the file with the filename Conversion.pas
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment