Monday, April 18, 2022

Convert Days to Years, Weeks and Days in C

Convert Days to Years, Weeks and Days in C

 Machine Problem 

Write a program to ask the user to give an input number of days and convert it to years, weeks, and days and display the result on 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 in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.


My mobile number here in the Philippines is 09173084360.


Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg


=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support





Program Listing


/* days.c
Convert days to years weeks and days
Author   : Jake Rodriguez Pomperada, MAED-IT, MIT
Websites  : jakerpomperada.com and jakerpomperada.blogspot.com
Email    : jakerpomperada@gmail.com
Tool     : Dev C++ Version 5.11
Date     : April 18, 2022  5:51 AM  Monday
*/

#include <stdio.h>

int main()
{
   int days=0, years=0, weeks=0;

   system("COLOR F0");
   printf("\n\n");
   printf("\tConvert Days to Years, Weeks and Days in C");
   printf("\n\n");
   printf("\tHow Many Days : ");
   scanf("%d", &days);

    /* Conversion in this portion */
    years = (days / 365);   /* Ignoring leap year */
    weeks = (days % 365) / 7;
    days  = days - ((years * 365) + (weeks * 7));

    printf("\n\n");
    printf("\tDisplay Results");
    printf("\n\n");
    printf("\tNumber of Years : %d\n", years);
    printf("\tNumber of Weeks : %d\n", weeks);
    printf("\tNumber of Days  : %d", days);
    printf("\n\n\n");
    printf("\tEND OF PROGRAM");
    printf("\n\n");
    }



Sunday, April 17, 2022

First and Last Number in Python

First and Last Number in Python

 A simple program to ask the user to give any number and then the program will find the first and last digit using Python programming language.


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 in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.


My mobile number here in the Philippines is 09173084360.


Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg




=================================================




Want to support my channel?


GCash Account


Jake Pomperada


09173084360




Paypal


https://paypal.me/jakerpomperada


Patreon


https://www.patreon.com/jakerpomperada


Thank you very much for your support





Program Listing


# first_last.py
# Jake Rodriguez Pomperada, MAED-IT, MIT
# www.jakerpomperada.blogspot.com and www.jakerpomperada.com
# jakerpomperada@gmail.com
# Bacolod City, Negros Occidental Philippines


import math

print()
print("\tFirst and Last Number in Python\n")
num_val = int(input("\tGive any number: "))

last = num_val % 10

while num_val >= 10:
num_val = num_val / 10

print()
print("\tThe First Digit :",math.trunc(num_val));
print("\tThe Last Digit : ",last);
print()
print("\tEnd of Program")
print()








Saturday, April 16, 2022

Simple Login in C#

Simple Login in C#

 A simple login program that is written in C# programming language.

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 in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg


=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada

Patreon

https://www.patreon.com/jakerpomperada

Thank you very much for your support





Program Listing

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;


namespace SimpleLogin

{

  class Program

  {

    static void Main(string[] args)

    {

      const int MaxLoginAttempts = 3;

      int loginAttempts = 0;

      bool loggedIn = false;

      const string password = "1234";


        Console.WriteLine("\n");

            Console.Write("\tSimple Login in C#\n");

       

   while (!loggedIn && loginAttempts < MaxLoginAttempts)

      {

        Console.Write("\n\n");

        Console.Write("\tEnter password: ");

        string input = Console.ReadLine();

        loginAttempts++;

        if(input == password)

          loggedIn = true;

      }

       Console.WriteLine("\n");

            if (loggedIn)

        Console.WriteLine("\tLogin succesfull.");

      else

        Console.WriteLine("\tLogin failed. You seem to be a hacker.");

      Console.WriteLine("\n");

      Console.Write("\tEnd of Program");

      Console.WriteLine("\n");

      Console.ReadKey();

    }

  }

}


Basic Math Operations in JavaScript

Basic Math Operations in JavaScript

 A simple program to show basic math operations like addition, subtraction, multiplication, and division of two numbers using JavaScript programming language.

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 in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg


=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada

Patreon

https://www.patreon.com/jakerpomperada

Thank you very much for your support








Program Listing

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>BASIC MATH OPERATIONS IN JAVASCRIPT</title>
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        body {
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: #EEEDED;
            color: #333;
            font-family: sans-serif;
        }
        main {
            padding: 50px;
            border-radius: 10px;
            background-color: #fff;
            min-width: 500px;
        }
        h1 {
            margin-bottom: 5px;
            font-size: 28px;
            text-align: center;
        }
        h2 {
            margin-bottom: 20px;
            font-size: 20px;
            text-align: center;
        }
        .block {
            margin: 12px auto 0;
            display: flex;
            align-items: center;
            width: 100%;
        }
        label {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 35%;
            line-height: 40px;
            background-color: #434343;
            color: #fff;
            height: 45px;
        }
        input,
        select {
            padding: 10px;
            width: 65%;
            font-size: 14px;
            border-radius: 0 5px 5px 0;
            border: 2px solid #434343;
            outline: none;
            height: 45px;
        }
        .btn {
            display: inline-block;
            padding: 15px;
            background-color: #FF3D57;
            color: #fff;
            outline: none; 
            border: none;
            cursor: pointer;
            width: 150px;
            width: 50%;
            font-size: 16px;
            text-decoration: none;
            text-align: center;
            transition: all .2s;
        }
        .btnReset {
            background-color: #FFCA00;
        }
        .btn:hover {
            opacity: 0.9;
        }
        .output {
            display: block;
            width: 100%;
            margin-top: 12px;
            padding: 20px 0;
            background-color: #434343;
            font-size: 16px;
            text-align:center;
            color: #fff;
        }
        .hide {
            display: none;
        }
    </style>
</head>
<body>
    <main class="container">
        <h1>BASIC MATH OPERATIONS IN JAVASCRIPT</h1>
        <h2>Jake R. Pomperada, MAED-IT, MIT</h2>
        <form action="" id="frmCalc">
            <div class="block">
                <label for="grade1">First Number:</label>
                <input type="number" id="number1" required autofocus>
            </div>
            <div class="block">
                <label for="grade2">Second Number:</label>
                <input type="number" id="number2" required>
            </div>
            <div class="block">
                <label for="operator">Select Operator:</label>
                <select id="operator" required>
                    <option value="Add">Add</option>
                    <option value="Subtract">Subtract</option>
                    <option value="Multipy">Multipy</option>
                    <option value="Divide">Divide</option>
                </select>
            </div>
            <div class="block">
                <button type="submit" class="btn">CALCULATE</button>
                <a href="" class="btn btnReset">RESET</a>
            </div>
            <div class="output hide"></div>
        </form>
    </main>

    <script>
        document.querySelector('#frmCalc').onsubmit  = (e) => {
            e.preventDefault()
            let calc = document.querySelector('.output'),
                operator = document.querySelector('#operator').value,
                numbers = document.querySelectorAll(`[id*="number"]`),
                total = 0, message;

            switch (operator) {
                case 'Add':
                    total = parseInt(numbers[0].value) + parseInt(numbers[1].value)
                    message = "The Sum is: "
                    break;
                case 'Subtract':
                    total = parseInt(numbers[0].value) - parseInt(numbers[1].value)
                    message = "The difference is: "
                    break;
                case 'Multipy':
                    total = parseInt(numbers[0].value) * parseInt(numbers[1].value)
                    message = "The product is: "
                    break;
                case 'Divide':
                    total = parseInt(numbers[0].value) / parseInt(numbers[1].value)
                    message = "The qoutient is: "
                    break;
            }

            calc.classList.remove('hide')
            calc.innerHTML = message+total.toFixed(2)
        }
    </script>
</body>
</html>

First and Last Number in C++

First and Last Number in C++

  A simple program to ask the user to give any number and then the program will find the first and last digit using C++ programming language.

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 in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg


=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada

Patreon

https://www.patreon.com/jakerpomperada

Thank you very much for your support





Program Listing

#include <iostream>


// first_last.cpp

// Jake Rodriguez Pomperada, MAED-IT, MIT

// jakerpomperada.com and jakerpomperada.blogspot.com

// jakerpomperada@gmail.com

// Bacolod City, Negros Occidental Philippines

// April 16, 2022  7:03 AM    Saturday


int main()

{

            int num_val = 0;

            

            int last = 0;

           

            std::cout << "\n";

            std::cout << "\tFirst and Last Number in C++";

            std::cout << "\n\n";

            std::cout << "\tGive any number: ";

            std::cin >> num_val;

            last = num_val % 10;


            while (num_val >= 10)

            {

                num_val = num_val / 10;

            }


           std::cout << "\n";

           std::cout << "\tThe first digit : " << num_val;

           std::cout << "\n\n";

           std::cout << "\tThe last digit  : " << last;

           std::cout << "\n\n";

           std::cout << "\tEnd of Program";

           std::cout << "\n";

    }


          


 



Friday, April 15, 2022

Prime Number Checker in JavaScript

Prime Number Checker in JavaScript

 A program that will ask the user to give a number and then the program will check if the given number is a prime number or not using JavaScript programming language.

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 in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg


=================================================

Want to support my channel?


GCash Account


Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada

 

Thank you very much for your support






Program Listing

index.htm

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Prime Number Checker in JavaScript</title>

    <style>

        * {

            box-sizing: border-box;

            margin: 0;

            padding: 0;

        }

        body {

            min-height: 100vh;

            display: flex;

            justify-content: center;

            align-items: center;

            background-color: #AAAF99;

            color: #000;

            font-family: sans-serif;

        }

        main {

            padding: 50px;

            border-radius: 10px;

            background-color: #fff;

            min-width: 500px;

        }

        h1 {

            margin-bottom: 5px;

            font-size: 28px;

            text-align: center;

        }

        h2 {

            margin-bottom: 30px;

            font-size: 20px;

            text-align: center;

        }

        .block {

            margin: 0 auto 12px;

            display: flex;

            align-items: center;


        }

        label {

            display: block;

            width: 35%;

            line-height: 40px;

            background-color: #2F4C58;

            color: #eee;

            text-align: center;

        }

        input {

            padding: 10px;

            width: 65%;

            font-size: 14px;

            border-radius: 0 5px 5px 0;

            border: 2px solid #000;

            outline: none;

        }

        .btnBlock {

            display: flex;

            width: 100%;

        }

        .btn {

            display: inline-block;

            padding: 15px;

            background-color: #63A583;

            color: #fff;

            outline: none; 

            border: none;

            cursor: pointer;

            width: 150px;

            width: 50%;

            font-size: 16px;

            text-decoration: none;

            text-align: center;

            transition: all .2s;

        }

        .btnReset {

            background-color: #6E93D6;

        }

        .btn:hover {

            opacity: 0.9;

        }

        .average {

            display: block;

            width: 100%;

            margin-top: 12px;

            padding: 20px 0;

            background-color: #2F4C58;

            font-size: 16px;

            text-align:center;

            color: #f3f3f3;

        }

        .hide {

            display: none;

        }

    </style>

</head>

<body>

    <main class="container">

        <h1>PRIME NUMBER CHECKER IN JAVASCRIPT</h1>

        <h2>Jake R. Pomperada, MAED-IT, MIT</h2>

        <form action="" id="frmCalc">

            <div class="block">

                <label for="val_num">Give A Number</label>

                <input type="number" min="1" max="100" id="val_num" autofocus required>

            </div>

           

            <div class="btnBlock">

                <button type="submit" class="btn">SUBMIT</button>

                <a href="" class="btn btnReset">RESET</a>

            </div><br>

            <div class="display_result hide"></div>

        </form>

    </main>


    <script>


       document.querySelector('#frmCalc').onsubmit  = (e) => {

            e.preventDefault()

            let i=0, chk=0;

            let display = document.querySelector('.display_result'),

               arr = document.getElementById("val_num");

                num_val = 0;

                num_val  = parseInt(arr.value);

                 


           for(i=2; i<num_val; i++)

            {

            if(num_val%2==0)

                {

                 chk++;

                 break;

                 }

       }

if(chk==0)

   result = num_val  + " is a Prime Number";

else

  result = num_val  + " is not a Prime Number";

           

            display.classList.remove('hide');

            display.innerHTML = "<h1>" + result + "</h1>";

      }

    </script>

</body>

</html>