Showing posts with label Fahrenheit. Show all posts
Showing posts with label Fahrenheit. 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

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. }

C Program to Convert Celcius to Fahrenheit and vice versa

How to write a C Program to Convert Celsius to Fahrenheit and vice versa in C Programming Language ?


Solution:

This Program converts the Temperature from Fahrenheit to Celsius and vice versa.

Temperature of a city in Fahrenheit degrees is input through the keyboard.

Write a program to convert this temperature into Centigrade degrees.


/*To convert Fahrenheit to Celsius, subtract 32 degrees and divide by 1.8.
To convert Celsius to Fahrenheit, multiply by 1.8 and add 32 degrees.*/

  1. #include<stdio.h>
  2.  
  3. main ()
  4. {
  5. float temp_c, temp_f;
  6.  
  7. printf ("Enter the value of Temperature in Celcius: ");
  8.  
  9. scanf ("%f", &temp_c);
  10.  
  11. temp_f = (1.8 * temp_c) + 32;
  12.  
  13. printf ("The value of Temperature in Fahreinheit is: %f", temp_f);
  14.  
  15. }

#include 

int main(void)
{
// Local Declarations
float Celsius, Fahrenheit, Fahrenheit_1, Celsius_2;

// Statements
printf("Enter the temperature in Fahrenheit: ");
scanf("%f", &Fahrenheit);
printf("Fahrenheit temperature is: %5.1f F\n\a", Fahrenheit);

Celsius = (100.0 / 180.0) * (Fahrenheit - 32);

printf("Celsius temperature is: %8.1f C\n\n\a", Celsius);

system("pause");
system("cls");

printf("Enter the temperature in Celsius: ");
scanf("%f", &Celsius_2);
printf("Celsius temperature is: %8.1f C\n\a", Celsius_2);

Fahrenheit_1 = 32 + (Celsius_2 * (180.0 / 100.0));

printf("Fahrenheit temperature is: %5.1f F\a", Fahrenheit_1);

system("pause");
return 0;
}// main