Sunday, August 22, 2021

Largest of Three Numbers in AngularJS

 Machine Problem

Write a program that will ask user to give three numbers, and then the program will find the largest of three given numbers by the user and then display the results in the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.


My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Program Listing

<!-- index.htm

  Author   : Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

  Date     : July 23, 2021  Friday  10:54 PM

  Place    : Bacolod City, Negros Occidental

  Websites : www.jakerpomperada.com and www.jakerpomperada.blogspot.com

  Email    : jakerpomperada@gmail.com

 -->

<html>

  <head>

    <title>Largest of Three Numbers in AngularJS</title>

  <script type="text/javascript" src="angular.min.js"></script>

    <script>

    var myApp=angular.module("myModule",[]);

    myApp.controller("Largest_Values",function($scope) {

    $scope.doFind=function()

    {

      var max_val = 0;

        if ($scope.a > $scope.b)

      {

      max_val = $scope.a;

    } else

    {

     max_val = $scope.b;

    }

    if ($scope.c > max_val) 

    {

     max_val = $scope.c;

    }

      $scope.result = "The Largest Number is " + max_val + ".";

  }

    

  });

     </script>

 </head>

 <style>

body {

font-family: arial;

font-size: 25px;

font-weight: bold;

}

</style>

 <body ng-app="myModule" ng-controller="Largest_Values">

  <h3>Largest of Three Numbers in AngularJS</h3>

 <div>

  <table border="0">

  <tr>

  <td>

  Enter Your First Number

  </td>

       <td>

         <input type="number" ng-model="a"/>

       </td>

      <tr>

  <td>

  Enter Your Second Number

  </td>

       <td>

         <input type="number" ng-model="b"/>

       </td>   

       </tr>

       <tr>

      <td>

      Enter Your Third Number

     </td>

       <td>

         <input type="number" ng-model="c"/>

       </td>   

       </tr>

      <tr>

      <td colspan="10">

      <input type="button" ng-click="doFind();"

      value="Find Largest Number"/>

      </td>

      </tr>

      </table>

     </div><br>

       {{result}}

    </div>

  </body>

</html>


No comments:

Post a Comment