#include <stdio.h>
#include <stdlib.h>
int main(void) {
int celsius = 0, kelvin = 0;
float farenheit;
printf("Enter the Boiling of water in Celcius \n");
scanf("%d", &celsius);
kelvin = 273 + celsius;
farenheit = celsius * (9 / 5) + 32;
printf("The Boiling point of water in Kelvin is %d \n and in farenheit is %f \n \n", kelvin, farenheit);
printf("Enter the Freezing point of water in Celcius \n");
scanf("%d", &celsius);
kelvin = 273 + celsius;
farenheit = celsius * (9 / 5) + 32;
printf("The freezing point of water in Kelvin is %d \n and in farenheit is %f \n \n", kelvin, farenheit);
return 0;
}
In eclipse, I type this code and I'm expecting it to ask me on console "Enter the Boiling of water in Celsius" and wait till i type in 100 and again do the same for freezing point. But after I build(ctrl+B), it does nothing. I had to enter some number(Here i did '100')then press 'enter' and again some number (here its '1') then press 'enter'. It displayed me the calculations for '100' degree Celsius.And it didn't even ask me to enter the freezing point either. I typed '1' and pressed enter. Whats wrong with my code.?
Here's my output.
100
1
Enter the Boiling of water in Celcius
The Boiling point of water in Kelvin is 373 and in farenheit is 132.000000
Enter the Freezing point of water in Celcius
The freezing point of water in Kelvin is 274 and in farenheit is 33.000000