I'm kind of new in C programming. To be honest this is my first program where I am using Function. But it's not working. Can anyone tell me what is supposed to be the problem?
// Convert freezing and boiling point of water into Fahrenheit and Kelvin
#include<stdio.h>
void calculation(int);
void freezingCalculation(void);
void boilingCalculation(void);
int main (){
int temperature, fahrenheit, kelvin;
void freezingCalculation(void){
int temperature = 0;
calculation(temperature);
printf("Freezing point in Fahrenheit is %d. \n", fahrenheit);
printf("Freezing point in Kelvin is %d. \n", kelvin);
}
void boilingCalculation(void){
int temperature = 100;
calculation(temperature);
printf("Boiling point in Fahrenheit is %d. \n", fahrenheit);
printf("Boiling point in Kelvin is %d. \n", kelvin);
}
void calculation(int temperature){
//Temperature in fahrenheit
fahrenheit = ((temperature * 9) / 5) + 32;
//Temperature in Kelvin
kelvin = temperature + 273;
}
}
Write your method (freezingCalculation etc) outside of main function and do not forget to return as your main function return type is integer.Like--