Machine Problem
Write a program that will ask user to give two numbers and then the program will display the original and swap arrangement of the two numbers given by the user.
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 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:26 PM
Place : Bacolod City, Negros Occidental
Websites : www.jakerpomperada.com and www.jakerpomperada.blogspot.com
Email : jakerpomperada@gmail.com
-->
<html>
<head>
<title>Swapping of Two Numbers in AngularJS </title>
<script type="text/javascript" src="angular.min.js"></script>
<script>
var myApp=angular.module("myModule",[]);
myApp.controller("Swapping_Values",function($scope) {
$scope.doSwap=function()
{
$scope.after_swap="Swap Arrangement : "
+ $scope.a + " and " + $scope.b;
var temp = $scope.a;
$scope.a = $scope.b;
$scope.b = temp;
$scope.before_swap="Original Arrangement : "
+ $scope.a + " and " + $scope.b;
}
});
</script>
</head>
<style>
body {
font-family: arial;
font-size: 25px;
font-weight: bold;
}
</style>
<body ng-app="myModule" ng-controller="Swapping_Values">
<h3>Swapping of Two 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 colspan="10">
<input type="button" ng-click="doSwap();"
value="Swap Numbers"/>
</td>
</tr>
</table>
</div><br>
{{ before_swap }}
<br><br>
{{ after_swap }}
</div>
</body>
</html>
No comments:
Post a Comment