#include<stdio.h>
#include<conio.h>
void main()
{
double temp,ctemp;
int ch;
clrscr(); //to clear the screen
printf(“Temprature Converrsion Menu”);
printf(“nt1.Fahrenheit to Celsius”);
printf(“nt2.Celsius to Fahrenheit”);
printf(“nEnter your choice(1/2):”);
scanf(“%d”,&ch);
if(ch==1)
{
printf(“Enter Temperature in Fahrenheit:”);
scanf(“%lf”,&temp);
ctemp=(temp-32)/1.8;
printf(“nTemprature in celcius is %lf”,ctemp);
}
else
if(ch==2)
{
printf(“Enter Temperature in Celsius:”);
scanf(“%lf”,&temp);
ctemp=(1.8*temp)+32;
printf(“nTemperature in Fahrenheit is %lf”,ctemp);
}
else
printf(“nWrong choice…..!!”);
getch(); //to stop the screen
}
Is it necessarsy use to header file in C programming?
Yes, you can write and run a c program without any header files. The following program will compile an run fine.
int main()
{
int i;
return 0;
}
To perform any operation you need functions and to use functions you have to include header files in your program. So, it will be no use of a program without header files.