Hello, I'm trying to write a console Java program here. I prompt the user for whether they want to convert from Celsius to Fahrenheit or Fahrenheit to Celsius. Then I do the conversion from which method they told me to use and print out the result. I was having lots of compiler errors before that I've fixed, but when I finally run it, nothing actually gets converted and printed. Here's my code: http://pastebin.com/UZhCg2Tu
For some reason, the 'temp' variable isn't being read by calc_celsius or calc_faren methods. I'm not sure why.
hey you are not specifying data type in printf statement , use %f before your C and F . Moreover in calc_celsius , there should be F not C because the answer is in Fahrenheit and similarly in calc_faren. there is another way too , you can remove printf statements and use println statements they show the right result too.
Ok, that's what it was. It seems to run fine now, and thanks for pointing out the mixup, now output makes sense :)
Join our real-time social learning platform and learn together with your friends!