programming2[1]

# programming2[1] - end Sample Outputs 7.222222 F is less...

This preview shows page 1. Sign up to view the full content.

9T EngE 1114 Programming2 10/22/06 Ghorai, Chhandak BB Programming 2 Problem 1 M file %Chhandak Ghorai %FtoC Convert degrees Fahrenheit to degrees Centigrade %input: tempF=temperature in fahrenheit %input: tempC=temperature in centigrade %output: the equivalent temperature in degrees fahrenheit tempF= input( 'Enter first temperature in degrees Fahrenheit: ' ); tempC= input( 'Enter second temperature in degrees Centigrade: ' ); F= (5/9)*(tempF-32); if F<tempC fprintf( '\n %.1f F is less than %.1f C\n' , tempF,tempC) elseif F>tempC fprintf( '\n %.1f F is greater than %.1f C\n' , tempF,tempC) elseif F==tempC fprintf( '\n %.1f F is equal to %.1f C\n' , tempF,tempC)
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end Sample Outputs 7.222222 F is less than 45.000000 C Enter first temperature in degrees Fahrenheit: 45 Enter second temperature in degrees Centigrade: 45 45.000000 F is less than 45.000000 C Enter first temperature in degrees Fahrenheit: 100 Enter second temperature in degrees Centigrade: 32 100.000000 F is greater than 32.000000 C Enter first temperature in degrees Fahrenheit: 32 Enter second temperature in degrees Centigrade: 32.000000 F is equal to 0.000000 C Enter first temperature in degrees Fahrenheit: 72 Enter second temperature in degrees Centigrade: 22.2 72.0 F is greater than 22.2 C...
View Full Document

## This note was uploaded on 03/19/2008 for the course ENGE 1114 taught by Professor Twknott during the Fall '06 term at Virginia Tech.

Ask a homework question - tutors are online