Fahrenheit To Celsius Converter

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. <h3>Fahrenheit To Celsius Converter</h3>
  2. <div ng-app="fahrenheitTocelsius">
  3. <p>Temperature in Fahrenheit:</p>
  4. <hr />
  5. <input type="number" step="1" autofocus="autofocus" ng-model="code_fahrenheit" maxlength="5" size="3"/>
  6. <hr />
  7. <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>
  8. </div>
JavaScript This is the script to get the result of Fahrenheit to Celsius.
  1. <script type="text/javascript" src="angular.min.js"></script>
  2.  
  3. <script>
  4. var app1 = angular.module('fahrenheitTocelsius', []);
  5. app1.filter('single_inDecimal', function ($filter) {
  6. return function (input) {
  7. if (isNaN(input)) return input;
  8. return Math.round(input * 10) / 10;
  9. };
  10. });
  11. app1.filter('setting_Decimal', function ($filter) {
  12. return function (input, places) {
  13. if (isNaN(input)) return input;
  14. var factor = "1" + Array(+(places > 0 && places + 1)).join("0");
  15. return Math.round(input * factor) / factor;
  16. };
  17. });
  18. app1.controller('Control_converter', function ($scope) {
  19. $scope.val = 1.56;
  20. });
  21. </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.  
  9. h3 {
  10. color:blue;
  11. font-family: "helvitica";
  12. font-style: bold;
  13. font-size: 20px;
  14. }
  15.  
  16. input[type='number'] {
  17. border:skyblue 3px solid;
  18. font-family: "helvitica";
  19. font-size: 18px;
  20. color:red;
  21. font-style: bold;
  22. width:100px;
  23. text-align:center;
  24. }
  25.  
  26. hr {
  27. width:500px;
  28. border:blue 1px solid;
  29. }
  30. </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.

Add new comment