Machine  Problem

Write a program that will ask user to give a string and then the program will display the given string, and then it will count the number of consonants in the given string.

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 and

My mobile number here in the Philippines is 09173084360.

Program Listing

<!-- index.htm
  Author   : Prof. Jake Rodriguez Pomperada, MAED-IT, MIT
  Date     : July 21, 2021  Wednesday  10:34 PM
  Place    : Bacolod City, Negros Occidental
  Websites : and
  Email    :
<html ng-app="mainApp">
	<title>Count Consonants in AngularJS</title>
body {
	font-family: arial;
	font-size: 25px;
	font-weight: bold;
<script type="text/javascript" src="angular.min.js">

<script type="text/javascript">

// AngularJS Controller Declaration
angular.module('mainApp', []).service('myService', function() {
  this.myFunc = function(val_1) {

    var countConsonants = 0;
     str_upper = val_1.toUpperCase();
  for (var i = 0; i < str_upper.length; i++) {
    if (str_upper.charAt(i) !== "A" && str_upper.charAt(i) !== "E" && str_upper.charAt(i) !== "I" 
      && str_upper.charAt(i) !== "O" && str_upper.charAt(i) !== "U" && str_upper.charAt(i) !== " ") {
    return countConsonants;
}).controller('Count_Consonants_Controller', function($scope, myService) {
  $scope.check = function(val_1) {
    $scope.myUserService = myService.myFunc(val_1);


<div ng-app="mainApp" ng-controller="Count_Consonants_Controller">
	<table border="0" cellspacing=10>
	<tr>Count Consonants in AngularJS</tr>
  	<td>Enter a String</td>
	<td><input type="text"  size="50" ng-model="val_1" ng-init="val_1=''" ng-keyup="check(val_1)"/></td>
	 <b>The given string {{val_1 | uppercase }}. </b><br><br>
   <b>The number of consonants is {{myUserService}}.</b>

Leave a Reply

Your email address will not be published.