C Program#180 – To Develop Temperature Converter using if-elseif Statement.

Program to Develop Temperature Converter using if-elseif Statement.:

Program Logic :

  • First, display a Menu with Two Options [1] Celsius to Fahrenheit , [2]Fahrenheit to Celsius & take input of choice in int data type variable.
  • Test input using test condition using if-elseif statement as below –
  • if( ch==1 ) then, input temperature in Celsius, compute using formula f=c*1.8+32;, and display it.
  • else if( ch==2 ) then, input temperature in Fahrenheit, compute using formula c=(f-32)/1.8;, and display it.
  • else display “Invalid Input, Please Lookup Menu System.”, error message.
  • Still not understood ? See the proper working example in action below.




Full Well Commented, Self-Explanatory Example Program of the same given below.

Below Here are Three (3) different Outputs of the program.



Output of the Program (Run 1 ):

Output of the Program (Run 2 ):

Output of the Program (Run 3 ):