• We just launched and are currently in beta. Join us as we build and grow the community.

Fahrenheit To Celsius Converter

lawnq

Media Outreach Manager
L Rep
0
0
0
Rep
0
L Vouches
0
0
0
Vouches
0
Posts
164
Likes
131
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
Related Code: Celsius To Fahrenheit Converter
Good Day!!!

Yesterday, I worked a program and it's called Celsius To Fahrenheit Converter. Today, we create another converter, and it's called Fahrenheit To Celsius Converter. If you want to do this manually. First, you have the method to convert the Fahrenheit to Celsius. You have to take time for solving.

But if you have this program, you don't need to do this manually to get the Fahrenheit to Celsius.

Kindly type a value in the box then it will automatically view the result.

HTML

This is the HTML code to input the user the value to convert and to see automatically the result.

  1. <center

    >
  2. <h3

    >

    Fahrenheit To Celsius Converter</

    h3

    >
  3. <div

    ng-app=

    "fahrenheitTocelsius"

    >
  4. <p

    >

    Temperature in Fahrenheit:</

    p

    >
  5. <hr

    /

    >
  6. <input

    type

    =

    "number"

    step=

    "1"

    autofocus=

    "autofocus"

    ng-model=

    "code_fahrenheit"

    maxlength

    =

    "5"

    size

    =

    "3"

    /

    >
  7. <hr

    /

    >
  8. <p

    >

    The temperature in Fahrenheit is <b

    style

    =

    "color:blue;"

    >

    {{ code_fahrenheit }}&deg;

    F </

    b

    >

    its equivalent to Celsius is <b

    style

    =

    "color:blue;"

    >

    {{ (code_fahrenheit - 32) * 5/9 | setting_Decimal:1}}&deg;

    C</

    b

    >

    .</

    p

    >
  9. </

    div

    >
  10. </

    center

    >

JavaScript

This is the script to get the result of Fahrenheit to Celsius.

  1. <

    script type=

    "text/javascript"

    src=

    "angular.min.js"

    ></

    script>

  2. <

    script>
  3. var

    app1 =

    angular.module

    (

    'fahrenheitTocelsius'

    ,

    [

    ]

    )

    ;
  4. app1.filter

    (

    'single_inDecimal'

    ,

    function

    (

    $filter)

    {
  5. return

    function

    (

    input)

    {
  6. if

    (

    isNaN(

    input)

    )

    return

    input;
  7. return

    Math

    .round

    (

    input *

    10

    )

    /

    10

    ;
  8. }

    ;
  9. }

    )

    ;
  10. app1.filter

    (

    'setting_Decimal'

    ,

    function

    (

    $filter)

    {
  11. return

    function

    (

    input,

    places)

    {
  12. if

    (

    isNaN(

    input)

    )

    return

    input;
  13. var

    factor =

    "1"

    +

    Array

    (

    +

    (

    places >

    0

    &&

    places +

    1

    )

    )

    .join

    (

    "0"

    )

    ;
  14. return

    Math

    .round

    (

    input *

    factor)

    /

    factor;
  15. }

    ;
  16. }

    )

    ;
  17. app1.controller

    (

    'Control_converter'

    ,

    function

    (

    $scope)

    {
  18. $scope.val

    =

    1.56

    ;
  19. }

    )

    ;
  20. </

    script>

CSS

And, this is the style.

  1. <style type=

    "text/css"

    >
  2. p {
  3. color

    :

    red

    ;
  4. font-family

    :

    "helvitica"

    ;
  5. font-style

    :

    bold

    ;
  6. font-size

    :

    18px

    ;
  7. }

  8. h3 {
  9. color

    :

    blue

    ;
  10. font-family

    :

    "helvitica"

    ;
  11. font-style

    :

    bold

    ;
  12. font-size

    :

    20px

    ;
  13. }

  14. input[

    type=

    'number'

    ]

    {
  15. border

    :

    skyblue

    3px

    solid

    ;
  16. font-family

    :

    "helvitica"

    ;
  17. font-size

    :

    18px

    ;
  18. color

    :

    red

    ;
  19. font-style

    :

    bold

    ;
  20. width

    :

    100px

    ;
  21. text-align

    :

    center

    ;
  22. }

  23. hr {
  24. width

    :

    500px

    ;
  25. border

    :

    blue

    1px

    solid

    ;
  26. }
  27. </style>

Related Code: Celsius To Fahrenheit Converter

So what can you say about this work? Share your thoughts in the comment section below or email me at [email protected]. Practice Coding. Thank you very much.


Download
You must upgrade your account or reply in the thread to view hidden text.
 

452,292

323,340

323,349

Top