Pages

» » C Programme to Convert Fahrenheit to Celsius

By: X Byte Lab Posted date: 14:55 Comments: 2
                   C Program for beginners
keywords: c program to convert fahrenheit to celsius, c language to convert temperature, c program to calculate temperature, c++ program to convert celsius, c++ program to convert fahrenheit,  c++ program to convert fernheit, easy way to convert temperature, temperature converter for beginner, program to convert temperature, easy program to convert temperature, c program to convert kelvin, fehrenheit, Fahrenheit, celcius, kelvin, standard temperature, easy c program to subtract, , simplest program, simplest c or c++ program, easy program of c language, use c programming to hack, learn JavaScript, learn Perl, learn html, learn css, learn, algorithm, c program for kid, c program, c++ program, easy c program, c program, first lesson in c program, learn c programming in 1 hour, x byte lab, xbyte, xbytelab, ashiq dey, author ashiq, author dey, easy way write c program, how to write a c program, google, google love you, use google, best search engine google, make money with google, google friendly, google seo, code x ,codex.blospot.in, codex-lab.blogspot, c language, subtract, earn money, sexy, girl, top most hacker, panty, ebook for c program, ebook to learn c, c ebook, c++ ebook.

C Programme to “Convert Fahrenheit to Celsius”  

  If you are new to C language then without wasting time Visit this linkBecause if you learn from beginning then only it will be beneficial for you and it will not take more than half an hour to learn the basics.

 

 A C/C++ program to Convert Fahrenheit to Celsius can be achieved through many ways. Here we showed only 2 of them. Like you we too don’t like boring lectures so we explained each step with friendly language which make learning enjoyable. Before heeding ahead you should know the basic keywords, variables, structure etc. If you are new to C Language you can know about them at this link. Still to make the learning process easy to understand, we explained about the program right below the code.


To know how to write and where to write the main structure of a C program visit this link.
To download application to write C/C++ program visit this link.
To get the list of all C programs for beginners visit this link.

Method 1

Sl. no.
Code
1
#include<stdio.h>
2
main()
3
{
4
float c,f;
5
     printf("Fahrenheit = ");
6
      scanf("%f",&f);                 
7
     c=(5.0/9.0)*(f-32);
8
     printf("\nCelsius: %f",c);
9
     return 0;
10
}
C is a case sensitive so everything should be as it is in the code, but within the “…” of printf function you can write with your choice
Explanation:
1. The first line of the program #include<stdio.h> is a preprocessor command, which tells a C compiler to include stdio.h (standard input output functions in the program from the library) file before going to actual compilation.
2. It is the main function where program execution begins.
3. Within the Braces we are going to write the program.
4. All the variable that we will use in the program have to be declared first in float and it represents floating point value, and why we have not use int data type is because, we want to display the numbers after point also.
And in C after every line we have to put ‘;’ symbol to declare that the line ended.
5. printf is a function available in C which causes the message Fahrenheit =  to be displayed on the screen.
6. scanf function used to read the values of f (It will take input from user)
Notice the syntax carefully, most beginner makes mistake here only,
NOTE: Here instead of %d we have %f used because it represents floating type value and %d represents integer type values
7. Line 7 is the formula to convert Fahrenheit to Celsius
Description: Description: 115
8. Last printf is going to print the result, you can position the text as you wish, see 2nd method for another style of displaying the text and result.And \n is used to start a new line.
9. return 0;  terminates main()function and returns the value 0.
Output of this program will look like as in screenshot


tags: c program to subtract, c language to subtract, c program to minus, c++ program to minus or subtract, easy way to subtract, easy c program to subtract, , simplest program, simplest c or c++ program, easy program of c language, use c programming to hack, learn JavaScript, learn Perl, learn html, learn css, learn, algorithm, c program for kid, c program, c++ program, easy c program, c program, first lesson in c program, learn c programming in 1 hour, x byte lab, xbyte, xbytelab, ashiq dey, author ashiq, author dey, easy way write c program, how to write a c program, googlegoogle love you, use google, best search engine google, make money with googlegoogle friendly, google seo, code x ,codex.blospot.in, codex-lab.blogspot, c language, subtract, earn money, sexy, girl, top most hacker, panty, ebook for c program, ebook to learn c, c ebook, c++ ebook.

Method 2

Sl. no.
Code
1
#include<stdio.h>
2
main()
3
{
4
float f;
5
printf("Fahrenheit = ");
6
scanf("%f",&f);
7
printf("\nCelsius: %f",(5.0/9.0)*(f-32));
8
return 0;
9
}

Explanation:
1. Here we have used only one variable(f) because this time we will write the formula in printf function itself.
2. In line 7 we have the printf function and it will print the result, here %f will take the value of (5.0/9.0)*(f-32)



keywords: c program to convert fahrenheit to celsius, c language to convert temperature, c program to calculate temperature, c++ program to convert celsius, c++ program to convert fahrenheit,  c++ program to convert fernheit, easy way to convert temperature, temperature converter for beginner, program to convert temperature, easy program to convert temperature, c program to convert kelvin, fehrenheit, Fahrenheit, celcius, kelvin, standard temperature, easy c program to subtract, , simplest program, simplest c or c++ program, easy program of c language, use c programming to hack, learn JavaScript, learn Perl, learn html, learn css, learn, algorithm, c program for kid, c program, c++ program, easy c program, c program, first lesson in c program, learn c programming in 1 hour, x byte lab, xbyte, xbytelab, ashiq dey, author ashiq, author dey, easy way write c program, how to write a c program, googlegoogle love you, use google, best search engine google, make money with googlegoogle friendly, google seo, code x ,codex.blospot.in, codex-lab.blogspot, c language, subtract, earn money, sexy, girl, top most hacker, panty, ebook for c program, ebook to learn c, c ebook, c++ ebook.

Output of this program will same as it was in the Method 1


Different method of writing this program

Sl. no.
Code
1
#include<stdio.h>
2
main()
3
{
4
float celsius,f;
5
     printf("Fahrenheit = ");
6
      scanf("%f",&f);                 
9
     celsius = (5.0/9.0)*(f-32);
10
     printf("\nCelsius: %f",celsius);
11
     return 0;
12
}


Sl. no.
Code
1
#include<stdio.h>
2
main()
3
{
4
float c,f;
5
printf("What is the temperature (in fahrenheit) = ");
6
      scanf("%f",&f);                 
9
     c = (5.0/9.0)*(f-32);
10
     printf("\Temperature in Fahrenheit was %f \nAnd the same temperature in Celsius is %f",f,c);
11
     return 0;
12
}


keywords: c program to convert fahrenheit to celsius, c language to convert temperature, c program to calculate temperature, c++ program to convert celsius, c++ program to convert fahrenheit,  c++ program to convert fernheit, easy way to convert temperature, temperature converter for beginner, program to convert temperature, easy program to convert temperature, c program to convert kelvin, fehrenheit, Fahrenheit, celcius, kelvin, standard temperature, easy c program to subtract, , simplest program, simplest c or c++ program, easy program of c language, use c programming to hack, learn JavaScript, learn Perl, learn html, learn css, learn, algorithm, c program for kid, c program, c++ program, easy c program, c program, first lesson in c program, learn c programming in 1 hour, x byte lab, xbyte, xbytelab, ashiq dey, author ashiq, author dey, easy way write c program, how to write a c program, googlegoogle love you, use google, best search engine google, make money with googlegoogle friendly, google seo, code x ,codex.blospot.in, codex-lab.blogspot, c language, subtract, earn money, sexy, girl, top most hacker, panty, ebook for c program, ebook to learn c, c ebook, c++ ebook.

I think now you got the point how to convert temperature, still if you have any doubt then please comment here or visit our Facebook page c++ for beginner at this link



«
Next
Newer Post
»
Previous
Older Post

2 comments:

Popular

Comments