Showing posts with label Celsius. Show all posts
Showing posts with label Celsius. Show all posts

C Program To Convert Temperature In Celsius To Fahrenheit, Using Function

How to write a C Program/Code To Convert Temperature In Celsius To Fahrenheit, Using Function in C Programming Language ?


Solution For C Program : 

/*C Program To Convert Temperature In Celsius To Fahrenheit, Using Function*/

#include <stdio.h>
void main()
{
void Fahrenheit(float c);
float c;
printf("\nEnter the Temperature in Celsius : ");
scanf("%f", &c);
Fahrenheit(c);
}
void Fahrenheit(float c)
{
printf("\nThe Temperature %0.2f Celsius = %0.2f Fahrenheit.", c, ( 9 * c) / 5 + 32);
return;
}


You may also learn these C Program/Code :

C Program To Swap Two Numbers Without Using Third Variable

C Program To Convert Temperature Into Celsius

How to write a C Program to convert given Temperature in Fahrenheit to Celsius, using Function in C Programming Language ?

Solution For C Program :

/*C Program To Convert Temperature Into Celsius*/

# include <stdio.h>
void main()
{
float f;
float Celsius(float f);
printf("\nEnter the Temperature in Fahrenheit : ");
scanf("%f", &f);
printf("\nThe %0.2f Fahrenheit = %0.2f Celsius.", f, Celsius(f));
}
float Celsius(float f)
{
return(5 * (f - 32) / 9);
}

You may also learn these C Program/Code :

C Program To Swap Two Numbers Without Using Third Variable

Celsius to Fahrenheit, Fahrenheit to Celsius and Kelvin to Fahrenheit

How to write a C Program to Convert Celsius to Fahrenheit, Fahrenheit to Celsius and Kelvin to Fahrenheit in C Programming Language ?

This C Program Change given temperature into Celsius to Fahrenheit, Fahrenheit to Celsius and Kelvin to Fahrenheit.

Temperature (F,C,K) is enter by the user through keyboard.

Solution:


  1. #include <stdio.h>
  2. int main(int argc, char **argv)
  3. {
  4.     float temp=0;
  5.     float kelvin=0;
  6.     float celsius=0;
  7.     float fahrenheit=0;
  8.     char unit;
  9.         printf("Enter a temperature number\n");
  10.     scanf("%f", &temp);
  11.     printf("you entered %f, what unit are you using(F,C,K)", temp);
  12.     scanf("%c,", &unit);
  13.     printf("%c."&unit);
  14.     if(unit=='c'){
  15.                 kelvin=temp-273.15;
  16.                 fahrenheit=temp*9/5+32;
  17.                 printf("%f Celsius =%f Fahrenheit and %f Kelvin", temp, fahrenheit, kelvin);
  18.         }
  19.         else if(unit=='f'){
  20.                 celsius=(fahrenheit-32)*5/9;
  21.                 kelvin=celsius-273.15;
  22.                 printf("%f Fahrenheit =%f Celsius and %f Kelvin", temp, fahrenheit, kelvin);
  23.         }
  24.         else if(unit=='k'){
  25.                 celsius=temp+273.15;
  26.                 fahrenheit=celsius*9/5+32;
  27.                 printf("%f Kelvin =%f fahrenheit and %f celsius", temp,fahrenheit, celsius);
  28.         }
  29.         else{
  30.                 printf("\n why did you do this");
  31.         }
  32.         return 0;
  33. }

C Program to Convert Celsius to Fahrenheit temperature

How to Write a C Program to Convert Celsius to Fahrenheit temperature in C Programming Language ?


This C Program to Convert Celsius to Fahrenheit temperature.

Solution:

  1. #include<stdio.h>
  2. #include<conio.h>
  3.  
  4. void main ()
  5. {    float c,f;
  6.     clrscr ();
  7.     printf ("Enter the value of celcius: ");
  8.     scanf ("%f",&c);
  9.     f=(float) 9/5*c+32;
  10.     printf ("\nFahrenheit is %.2f",f);
  11.     getch ();
  12. }