FRee html code for percent to fraction convertor calculator online

We will try to give you a new code for every day . 

You can create your tool website and earn unlimited with google and google adsense. 
You can create your free website with the google product name as Blogger. 
You just open Blogger.com 
create your account and write or paste this code in the html view of your blogger. 

so the Code is given below you can copy and paste in your website . 

Here is a code for  percent to fraction convertor HTML code    








 <html lang="en">

<head>

    <meta charset="UTF-8"></meta>

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

    <title>Percent to Fraction Converter</title>

    <style>

        body {

            font-family: Arial, sans-serif;

            text-align: center;

            margin: 50px;

        }

    </style>

</head>

<body>

    <h2>Percent to Fraction Converter</h2>

    <label for="percentInput">Enter Percent (e.g., 50%):</label>

    <input id="percentInput" placeholder="Enter percent" type="text" />

    <button onclick="convertPercentToFraction()">Convert</button>


    <p id="result"></p>


    <script>

        function convertPercentToFraction() {

            // Get the percent input value

            var percentInput = document.getElementById("percentInput").value;


            // Remove the percent symbol if present

            percentInput = percentInput.replace('%', '');


            // Convert percent to fraction

            var fraction = percentToFraction(parseFloat(percentInput));


            // Display the result

            document.getElementById("result").innerHTML = "Fraction: " + fraction;

        }


        function percentToFraction(percent) {

            // Convert percent to fraction

            var fraction = percent / 100;

            var gcd = findGCD(percent, 100);


            // Simplify the fraction

            var numerator = percent / gcd;

            var denominator = 100 / gcd;


            // Format the result as a fraction

            return numerator + '/' + denominator;

        }


        function findGCD(a, b) {

            // Find the Greatest Common Divisor (GCD) using Euclidean algorithm

            return b === 0 ? a : findGCD(b, a % b);

        }

    </script>

</body>

</html>


Comments

Popular posts from this blog

बस माल पैक करो और कंपनी को वापस कर दो और 60 हजार रुपए महीना कमाओ, bindi packing business

घर बैठे करे पैकिंग का काम कमाए लाखो रूपये महीना , पॉपकॉर्न कंपनी दे रही है मौका

3 ONLINE EARNING APP , NO CONDITION , NO INVESTMENT , ONLY EARNING , घर बैठे पैसा कमाने के लिए 3 सबसे बढ़िया APP .