Programming 2 - Problem Source Blackboard Programming 2...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Problem Source: Blackboard Programming 2 Number 1 Given: Temperature in Celsius, Temperature in Fahrenheit Required: Whether or not temperatures are equal Solution: Start Input TempF TempC TempFtoC = FtoC (Temp F) |TempFtoC – TempC|<0.5 Output TempF is not equal to TempC Output TempF is equal to TempC Stop % FequalC.m Tran, Nathaniel 16184-F % Compares temperature in Celsius to Temp in Fahrenheit TempF = input( 'Enter Temperature in degrees Fahrenheit:' ); TempC = input( 'Enter Temperature in degrees Celsius:' ); TempFtoC = FtoC(TempF); if abs(TempFtoC-TempC)<0.5 fprintf ( '\n %.1f F is equivalent to ' , TempF) fprintf ( '%.1f C' , TempC) else fprintf ( '\n %.1f F is not equivalent to ' , TempF) fprintf ( '%.1f C' , TempC) end Enter Temperature in degrees Fahrenheit:45 Enter Temperature in degrees Celsius:45 45.0 F is not equivalent to 45.0 C>>
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Enter Temperature in degrees Fahrenheit:32 Enter Temperature in degrees Celsius:0 32.0 F is equivalent to 0.0 C>> Enter Temperature in degrees Fahrenheit:72 Enter Temperature in degrees Celsius:22.2 72.0 F is equivalent to 22.2 C>>
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

Programming 2 - Problem Source Blackboard Programming 2...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online