Exercise 9 - Faulty Calculator | Sigma Web Development Course - Tutorial #59

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 1,2 тыс.

  • @CodeWithHarry
    @CodeWithHarry  11 месяцев назад +364

    If you are enjoying this course, make sure to write a review comment in the first video of this course. I will be very happy if you go and do that 🙂

  • @stapleworld
    @stapleworld 10 месяцев назад +51

    harry bhaiya thank you for this course. i leaved behind in this course due to college exams so i reached today on this vdo .
    i accept the challenge and my answer is
    console.log(" faulty calculatar ")
    if (Math.random() < 0.1){
    function sum(a,b){
    return a-b
    }
    function sub(a,b){
    return a/b
    }
    function mul(a,b){
    return a+b
    }
    function div(a,b){
    return a**b
    }
    }
    else{
    function sum(a,b){
    return a+b
    }
    function sub(a,b){
    return a-b
    }
    function mul(a,b){
    return a*b
    }
    function div(a,b){
    return a/b
    }
    }

    let c = sum(16,14)
    let d = sub(16,14)
    let p = mul(16,14)
    let q = div(16,14)
    console.log("output of operation --->> "+ c)
    console.log("output of operation --->> "+ d)
    console.log("output of operation --->> "+ p)
    console.log("output of operation --->> "+ q)

  • @FutureElonMusk8
    @FutureElonMusk8 11 месяцев назад +66

    Please bhaiya is course ko future Mai bilkul mat hatana 😭😭
    I'm in junior college not able to attend this course please keep it free only
    This is the best course jo I.T. subject ham college mai sikhte hai 6months ka aapne sirf 2 videos mai complete Kiya
    Thankyou ❤❤

    • @owaiskazi4028
      @owaiskazi4028 11 месяцев назад +3

      😂😂

    • @shivanshupadhyay7245
      @shivanshupadhyay7245 11 месяцев назад

      Konse duniya ka h tu?

    • @SANTOSH_Raut
      @SANTOSH_Raut 11 месяцев назад

      haha 😂😂🤣🤣@@shivanshupadhyay7245

    • @SANTOSH_Raut
      @SANTOSH_Raut 11 месяцев назад +2

      Why don't you go to through the documentation of the js and old js ultimate course?
      Ther's enough information available if you want to learn. If you don't then toh bhagwaan hi apka bhala kare........ #no_bhana

    • @Stark7_World
      @Stark7_World 11 месяцев назад +3

      Bhai Harry bhai apna koi bhi course nhi hatate

  • @shreyamukherjee3429
    @shreyamukherjee3429 10 месяцев назад +10

    Faulty Calculator ready bro 🎉. Thank you brother for such videos💌.

  • @mohdtanveeralam3000
    @mohdtanveeralam3000 11 месяцев назад +8

    Ye same exercise old Python Tutorial playlist mai bhi thi❤

  • @Beauty_salon56
    @Beauty_salon56 Месяц назад

    You is the best teacher in all over the WORLD and this course is best course .

  • @just.sumit.14
    @just.sumit.14 11 месяцев назад +42

    Hellow bhaiya,
    I started this series 10 day before today .So, I was now on 22nd video.
    But I was enjoying the series and it help me lot. Now I am in class 10, but I literally understand the topics.
    once again thank you for this free series.
    thanking you
    your truly
    SUMIT

    • @soumyaranjansahoo5199
      @soumyaranjansahoo5199 11 месяцев назад +7

      Beta padhaiye pe dhyan de ,yahan nhin

    • @SudhanshuKumar-n9s
      @SudhanshuKumar-n9s 11 месяцев назад +5

      @@soumyaranjansahoo5199 ye v to padhai hi hai ispe bechara dhyan de rha hai

    • @armyrusharmyrush6737
      @armyrusharmyrush6737 10 месяцев назад

      Same me bhi 10 class me hu

    • @d_1127
      @d_1127 10 месяцев назад +2

      @@armyrusharmyrush6737 me to 8th pe hun html, css tailwind bootstrap, python or ab js sikh rha hun

    • @armyrusharmyrush6737
      @armyrusharmyrush6737 10 месяцев назад

      What's your goal

  • @sapnendra
    @sapnendra 11 месяцев назад +6

    5 million - advance congratulations Harry Bhaiya😄😄

  • @Ashish...114
    @Ashish...114 11 месяцев назад +5

    iss exercise ko solve krne m bahut mja aaya🤗🤗🤗
    #SigmaBatchOp
    #JavaScriptOp

  • @lufi_609
    @lufi_609 2 месяца назад +3

    if you are having a problem in vs code regarding the prompt then run this in the terminal:-
    npm install prompt-sync

  • @infotechlearning1722
    @infotechlearning1722 11 месяцев назад +14

    #ChallengeAccepted
    #Solution:
    i increase the probability to 60% because on checking while executing the code i was confused
    and i also used readline to execute the code within node.js
    const readline = require('readline');
    const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
    });
    function faultycalculator(operator, a, b) {
    let result;
    const isFaulty = Math.random() < 0.6;
    console.log(`isFaulty: ${isFaulty}`);
    if (isFaulty) {
    // Perform faulty operation
    switch (operator) {
    case '+':
    result = a - b; // Faulty addition (subtraction)
    break;
    case '-':
    result = a / b; // Faulty subtraction (addition)
    break;
    case '*':
    result = a + b; // Faulty multiplication (addition)
    break;
    case '/':
    result = a ** b; // Faulty division (exponential)
    break;
    default:
    console.log("Invalid operator");
    break;
    }
    } else {
    // Perform correct operation
    switch (operator) {
    case '+':
    result = a + b;
    break;
    case '-':
    result = a - b;
    break;
    case '*':
    result = a * b;
    break;
    case '/':
    result = a / b;
    break;
    default:
    console.log("Invalid operator");
    break;
    }
    }
    return result;
    }
    rl.question("Enter the first number: ", function (a) {
    rl.question("Enter the operator (+, -, *, /): ", function (operator) {
    rl.question("Enter the second number: ", function (b) {
    const result = faultycalculator(operator, parseFloat(a), parseFloat(b));
    console.log(`Result of ${a} ${operator} ${b} is: ${result}`);
    rl.close();
    });
    });
    });

    • @santoshgonnar8
      @santoshgonnar8 9 месяцев назад

      you should use process.argv[2]

    • @aryamukherjee434
      @aryamukherjee434 3 месяца назад +3

      why did you make it so complicated? it was a simple if and else program...do as much as is asked...your time will be saved also questionnaire will be happy

    • @firojshaikh9759
      @firojshaikh9759 2 месяца назад +1

      brother, all of students solved this question by using if else statement. this brother did very well for other students. because he show us that it can also do with using switch case and function

  • @sigmai123
    @sigmai123 7 месяцев назад +1

    This course is very helpful for me.

  • @rajafahad6619
    @rajafahad6619 11 месяцев назад +15

    it's a difficult challenge, but also very interesting.It takes about an hour to solve the problem
    // const prompt = require("prompt-sync")();
    let num1 = prompt("Enter your first number: ");
    let num2 = prompt("Enter your second number: ");
    num1 = Number.parseInt(num1);
    num2 = Number.parseInt(num2);
    let operation = prompt("What operation do you want to perform? ");
    let CPU = Math.floor(Math.random() * 10);
    console.log("CPU:", CPU);
    let sum, minus, multiply, divide;
    if (CPU > 1) {
    sum = (a, b) => a + b;
    minus = (a, b) => a - b;
    multiply = (a, b) => a * b;
    divide = (a, b) => (b !== 0 ? a / b : "Cannot divide by zero.");
    } else {
    sum = (a, b) => a - b;
    minus = (a, b) => (b !== 0 ? a / b : "Cannot divide by zero.");
    multiply = (a, b) => a - b;
    divide = (a, b) => a * b;
    }
    let result1 = sum(num1, num2);
    let result2 = minus(num1, num2);
    let result3 = multiply(num1, num2);
    let result4 = divide(num1, num2);
    if (operation === "sum") {
    // console.log(`${num1} ${operation} ${num2} is equal to ${result1}`);
    console.log("The sum of the numbers is", result1);
    }
    if (operation === "minus") {
    // console.log(`${num1} ${operation} ${num2} is equal to ${result2}`);
    console.log("The minus of the numbers is", result2);
    }
    if (operation === "multiply") {
    // console.log(`${num1} ${operation} ${num2} is equal to ${result3}`);
    console.log("The multiply of the numbers is", result3);
    }
    if (operation === "divide") {
    // console.log(`${num1} ${operation} ${num2} is equal to ${result4}`);
    console.log("The divide of the numbers is", result4);
    }
    if (operation !== "sum" && operation !== "minus" && operation !== "multiply" && operation !== "divide") {
    console.log("The operator is incorrect. You should use lowercase words");
    }
    hope you like it 😊😊😊😊

    • @inderpal_singh_
      @inderpal_singh_ 11 месяцев назад +4

      impressive 👍👍

    • @rajafahad6619
      @rajafahad6619 11 месяцев назад

      thanks bro @@inderpal_singh_

    • @abhijeetanand8287
      @abhijeetanand8287 11 месяцев назад

      bhai 10 min. me kr lia bro

    • @codeXsnippet
      @codeXsnippet 6 месяцев назад +1

      Hey be honest, how do you wrote this code by just watching 5 basic videos of js in this course? Bro, I cant be able to figure out how to take input from user by using prompt & How did you wrote this code bruh!!! Did you learn javascript before???

    • @updeshsthal
      @updeshsthal 6 месяцев назад +1

      @@codeXsnippet bhai kisi aur language me padh rakha hoga baki syntax alag h

  • @_Rohit__Kumar_
    @_Rohit__Kumar_ 11 месяцев назад +4

    Congratulations for 5 million subscribers in advance ❤️❤️❤️❤️ #HarryBhai🎉🎉

  • @kunalpratapsingh982
    @kunalpratapsingh982 11 месяцев назад +2

    Ek hi dil ko kitni baar jitoge bhaiyaa ❤❤❤❤❤

  • @Fastdesign112
    @Fastdesign112 11 месяцев назад +10

    Bhaiya mere ko Ghar se uthawaa lo❤❤❤❤❤❤😂😂😂 Dil jit lete ho bhaiya. I am Software Engineer. And I am Founder of Fastdesign pvt Ltd

    • @fact2.049
      @fact2.049 8 месяцев назад +2

      Koi job ha

    • @adeelahmad3889
      @adeelahmad3889 7 месяцев назад

      hn h bs ya sochna h ka paise kesaa ayn ga
      @@fact2.049

  • @tarakcomedy191
    @tarakcomedy191 11 месяцев назад +2

    congratulations! harry bhai you have got 5M subscribe mene aapke 20 subscribe badaye hai 👌👌👌👌🌹🌹

  • @bilalkhan-cs7fi
    @bilalkhan-cs7fi Месяц назад +3

    honestly you taught like 50% of what you asked us to do in this excercise

    • @yashchourasia9555
      @yashchourasia9555 Месяц назад

      sahi mai yrr bhai isne funtions tak padhaya aur exerxise itna hard

  • @random_akki
    @random_akki 7 месяцев назад

    Thanks bhaiya for the playlist
    Here is my code
    function sum(a,b)
    {
    result=a+b;
    console.log(result);
    }
    function sub(a,b)
    {
    result=a-b;
    console.log(result);

    }
    function div(a,b)
    {
    result=a/b;
    console.log(result);

    }
    function mul(a,b)
    {
    result=a*b;
    console.log(result);

    }
    function expo(a,b)
    {
    result=a**b;
    console.log(result);

    }
    // let a= readInt("Enter the number a");
    // let b=readInt("ENter the number b");
    let a=8;
    let b=10;
    if(Math.random()

  • @haseebkhalid1603
    @haseebkhalid1603 11 месяцев назад +43

    // Input Numbers
    let a = Number(prompt("Enter your number 1 "));
    let b = Number(prompt("Enter your number 2 "));
    // Random Number
    let random = Math.random();
    let addition = a+b ;
    let Subtraction = a-b;
    let Multiplication =a*b;
    let Division= a/b;
    let Exponentiation = a**b;
    // Condition
    if (random

    • @amannettic4994
      @amannettic4994 5 месяцев назад +1

      bhai input kaise lete he, me prompt karta hu to terminal me "prompt is not defined " dikhata he

    • @maryamdanial15
      @maryamdanial15 4 месяца назад

      @@amannettic4994 Use const prompt = require('prompt-sync')(); at the start of your code..

    • @CodewithHS1
      @CodewithHS1 2 месяца назад +1

      Ya work hi nhi krta

    • @CodewithHS1
      @CodewithHS1 2 месяца назад +1

      Mugha to smaj nhi a rhi abhi 6 7 lecture liay hay or asa kuch sikha bhi nhi jo project mil gya

    • @amannettic4994
      @amannettic4994 2 месяца назад +1

      @@CodewithHS1 time do, isme logo ka 40-50 lpa ka package lagta he, itna jaldi thodi samajh aayega, time lagega min- 3 months ache se samajh ke functional website banane me

  • @Beauty_salon56
    @Beauty_salon56 Месяц назад

    Its very tough exercise but i will to do it with full interest .

  • @gobind4872
    @gobind4872 9 месяцев назад +3

    Challenge Accepted 👍
    let random = Math.random();
    let Num1 = parseFloat(prompt("enter first number"));
    let operator = prompt("enter operator");
    let Num2 = parseFloat(prompt("enter second number"));
    if (random > 0.1) {
    if (operator === "+") result = Num1 + Num2;
    else if (operator === "-") result = Num1 - Num2;
    else if (operator === "*") result = Num1 * Num2;
    else if (operator === "/") result = Num1 / Num2;
    else if (operator === "**") result = Num1 ** Num2;
    } else {
    if (operator === "+") result = Num1 - Num2;
    else if (operator === "-") result = Num1 / Num2;
    else if (operator === "*") result = Num1 + Num2;
    else if (operator === "/") result = Num1 ** Num2;
    }
    console.log("result is ", result);

  • @Engineering_Unlocked
    @Engineering_Unlocked 16 дней назад

    challenge accepted bhaiya :)
    here's code /*
    Create a faulty calculator using JavaScript
    This faulty calculator does following:
    1. It takes two numbers as input from the user
    2. It perfoms wrong operations as follows:
    + ---> -
    * ---> +
    - ---> /
    / ---> **
    It performs wrong operation 10% of the times
    */
    function calc(a,b,operator)
    {
    if(Math.random()

  • @AdityaArya2207
    @AdityaArya2207 11 месяцев назад +6

    Challenge Accepted
    Solution
    // Enter 1 in operator for additon 2 for substraction 3 for multiplication and 4 for division
    function calculate (operator,a,b){
    let random = Math.random();
    if(operator === 1){
    let add=(a,b)=>{
    if(random{
    if(random{
    if(random{
    if(random

  • @KartikMittal-jb3ek
    @KartikMittal-jb3ek 2 месяца назад +1

    vid_59 completed!

  • @tonybadmoosh3172
    @tonybadmoosh3172 25 дней назад

    10 months ago
    Please bhaiya is course ko future Mai bilkul mat hatana 😭😭
    I'm in junior college not able to attend this course please keep it free only
    This is the best course jo I.T. subject ham college mai sikhte hai 6months ka aapne sirf 2 videos mai complete Kiya
    Thankyou ❤❤

  • @ShahidAli-in6uv
    @ShahidAli-in6uv 11 месяцев назад +12

    Challenge Accepted! #SigmaBatchOp Harry Bhai!
    Here is my efforts
    #solution
    // Input Numbers
    let a = Number(prompt("Enter your number 1 "));
    let b = Number(prompt("Enter your number 2 "));
    // Random Number
    let random = Math.random();
    let addition = a+b ;
    let Subtraction = a-b;
    let Multiplication =a*b;
    let Division= a/b;
    let Exponentiation = a**b;
    // Condition
    if (random

    • @ansh77775
      @ansh77775 11 месяцев назад +1

      nice

    • @techgamertej2811
      @techgamertej2811 11 месяцев назад

      bro in vs code prompt is not defined

    • @SunilBSSS
      @SunilBSSS 11 месяцев назад

      ​@@techgamertej2811use browser console

    • @santoshgonnar8
      @santoshgonnar8 9 месяцев назад

      @@techgamertej2811 bro use process.argv[2]

    • @noT_creepEr
      @noT_creepEr 7 месяцев назад

      @techgamertej2811 lol

  • @ANIKETSISODIA-y9f
    @ANIKETSISODIA-y9f 8 месяцев назад +1

    Congratulations for 5M❤🎉

  • @gamedevadi
    @gamedevadi 11 месяцев назад +3

    I think this should work :
    /*
    Question: Create a Faulty calculator using the javascript such that the faulty calculator does the following things:
    01. it takes two numbers input from the user
    02. It performs wrong operations as follows
    + -------> -
    - ---------> +
    * ---------> /
    / ----------> **
    Also note that you are hired to make a faulty calculator for a college where the college wants the students to do their calculations by themselves so make sure that the calculator should be working faulty on 10 % of the times that means the calculator should give wrong output only 10% in 100 operations performed
    */
    // Solution try #1
    console.log("Making faulty Calculator:");
    // Taking Necessary inputs from the user
    let start = prompt("Press 1 to start the calculator ") // usually the start button of classic calci are like
    console.log(start);
    if (start == 1) {
    console.log("Hello Lets calculate:");
    let num1 = parseFloat(prompt("Enter the First Number:"));
    let num2 = parseFloat(prompt("Enter the second Number:"));
    console.log("Select the operation to perform");
    console.log(" 01.Press 1 for the Addition");
    console.log(" 02.Press 2 for the subtraction");
    console.log(" 03.Press 3 for the Multiplication");
    console.log(" 04.Press 4 for the Division");
    let operate = prompt(":");
    if (operate == 1) {
    console.log(add());
    }
    else if (operate == 2) {
    console.log(sub());
    }
    else if (operate == 3) {
    console.log(multi());
    }
    else if (operate == 4) {
    console.log(div());
    }
    else {
    console.log("Wrong Input:");
    }
    function add() {
    if (Math.random() < 0.1) {
    return +num1 + +num2 - Math.random();
    }
    return num1 + num2;
    }
    function sub() {
    if (Math.random() < 0.1) {
    return -num1 - +num2 - Math.random();
    }
    return num1 - num2;
    }
    function multi() {
    if (Math.random() < 0.1) {
    return num1 * num2 / Math.random();
    }
    return num1 * num2;
    }
    function div() {
    if (Math.random() < 0.1) {
    return num1 / num2 ** Math.random();
    }
    return num1 / num2;
    }
    }
    else {
    console.log("Error Please Press One:");
    }

  • @ankyie7544
    @ankyie7544 10 месяцев назад +20

    #ChallengeAccepted
    Input needs to be manually added to the code (look at the end):
    #Solution
    console.log("Welcome to faulty calculator");
    function calculator_faulty(x,y,operator) {
    if (Math.random() < 0.1) {
    if(operator == '+'){
    console.log(x - y);
    }
    else if(operator == '-'){
    console.log(x / y);
    }
    else if(operator == '*'){
    console.log(x + y);
    }
    else if(operator == '/'){
    console.log(x ** y);
    }
    else{
    console.log("Invalid operator");
    }
    }
    else{
    if(operator == '+'){
    console.log(x + y);
    }
    else if(operator == '-'){
    console.log(x - y);
    }
    else if(operator == '*'){
    console.log(x * y);
    }
    else if(operator == '/'){
    console.log(x / y);
    }
    else{
    console.log("Invalid operator");
    }
    }
    }
    calculator_faulty(4,2,'/');

  • @asadullahjamil0
    @asadullahjamil0 2 месяца назад

    Thanks a lot for such an amazing course..❤❤❤

  • @atifshaikh169
    @atifshaikh169 11 месяцев назад +4

    #Challenge Accepted
    #SigmaBatchOp
    #JsBatchOp
    // My Solution for this Exercise
    // Hope You will understand this
    function add(n1,n2){
    let randomNumber = Math.random();
    console.log(randomNumber)
    if (randomNumber < 0.1){
    return (n1 - n2) + randomNumber;
    }
    else{
    return n1 - n2;
    }
    }
    function multiply(n1,n2){
    let randomNumber = Math.random();
    console.log(randomNumber)
    if (randomNumber < 0.1){
    return (n1 + n2) * randomNumber;
    }
    else{
    return n1 + n2;
    }
    };
    function substract(n1,n2){
    let randomNumber = Math.random();
    console.log(randomNumber)
    if (randomNumber < 0.1){
    return (n1 / n2) - randomNumber;
    }
    else{
    return n1 / n2;
    }
    };
    function devide(n1,n2){
    let randomNumber = Math.random();
    console.log(randomNumber)
    if (randomNumber < 0.1){
    return (n1 ** n2) / randomNumber;
    }
    else{
    return n1 ** n2;
    }
    };
    // Creating the High Order function
    function calculator(n1,n2,operator){
    return operator(n1,n2);
    };
    // Save the value in variable help of return statement
    //yaha multiply ke jaga koi bhi operator call kar sakte hai jo humne create kiye hai
    let result = calculator(3,2,multiply)
    // console log the saved value
    console.log(result);

    • @atifshaikh169
      @atifshaikh169 11 месяцев назад +1

      Kuch nahi hash tag dalna bhul gaya tha isly edit kiya

    • @ahsanali8237
      @ahsanali8237 11 месяцев назад

      return n1 - n2 + randomNumber;
      return (n1 + n2) * randomNumber;
      return n1 / n2 - randomNumber;
      return n1 ** n2 / randomNumber;
      ye use kun kia he apne?

    • @atifshaikh169
      @atifshaikh169 11 месяцев назад +1

      @@ahsanali8237 bro jab Randome number ki value 0.1 hogi tab mai ne alag alag function me random number ko use kiya hai jaise
      Add ke function me mai ne random number ko add kiya aur multiply function me multiply kiya hai take Calculation aur galat aa jaye aap chaho to random number ko simply add kar sakte ho har jaga
      Jaise multiply function me
      if (randomNumber < 0.1) {
      return (n1 + n2) + randomNumber
      }
      else{ return n1 +n2}
      yaha (n1 + n2 ) + randomNumber tab apply hoga jab randomNumber ki value 0.1 se kam hogi aur humara answer 10% galat extra galat ho jayega agar nahi hogi to return (n1+n2) pass ho jayega lekin ye bhi wrong hi hai kiw k calculator hume galat banana hai

    • @ahsanali8237
      @ahsanali8237 11 месяцев назад

      @@atifshaikh169 Okay bro Got It. Thanks

    • @atifshaikh169
      @atifshaikh169 11 месяцев назад

      @@ahsanali8237 Keep Learning ❤️

  • @freestylerjoy296
    @freestylerjoy296 11 месяцев назад +5

    Challenge Accepted Harry Bhaiya
    #Solution 👇🏽
    let rand = Math.random();
    // Addition :
    function Add(a, b) {
    if (rand > 0.3) {
    let sum = a + b;
    console.log(sum);
    } else {
    let sum = a - b;
    console.log(sum);
    }
    }
    Add(10, 3);
    // Multiplication :
    function Multiply(a, b) {
    if (rand > 0.3) {
    let mult = a * b;
    console.log(mult);
    } else {
    let mult = a + b;
    console.log(mult);
    }
    }
    Multiply(5, 3);
    // Substraction :
    function Substraction(a, b) {
    if (rand > 0.3) {
    let sub = a - b;
    console.log(sub);
    } else {
    let sub = a / b;
    console.log(sub);
    }
    }
    Substraction(10, 2);
    // Division :
    function Divide(a, b) {
    if (rand > 0.3) {
    let div = a / b;
    console.log(div);
    } else {
    let div = a ** b;
    console.log(div);
    }
    }
    Divide(6, 2);

  • @whitefox3858
    @whitefox3858 2 месяца назад

    Harry bhai JS basic apne jaldbazi me shika diya muje apke old js playlist dekhna pada ise solve krne k liye
    let random = Math.random();
    console.log(random)
    let num1 = parseFloat(prompt("enter number"));
    let op = prompt("enter op");
    let num2 = parseFloat(prompt("enter number"));
    if (random < 0.1) {
    if (op === "+") result = num1 - num2
    else if (op === "*") result= num1 + num2
    else if (op === "-") result= num1 / num2
    else if (op === "/") result= num1 ** num2
    }
    else {
    if (op === "+") result= num1 + num2
    else if(op === "*") result= num1 * num2
    else if(op === "-") result= num1 - num2
    else if(op === "/") result= num1 / num2
    }
    console.log(result)
    answer = alert(result)

    • @MDPRO5
      @MDPRO5 2 месяца назад

      yes biro wahi me sochu mjhe toa iska strting bhi nhi pata ki kesey kru

    • @MDPRO5
      @MDPRO5 2 месяца назад

      aap mjhe inki old playlist share kr skte ho

  • @redn4443
    @redn4443 11 месяцев назад +3

    #SigmaBatchOp
    Challenge accepted🔥
    let a = 23;
    let b = 12;
    let c = Math.random();
    let div = a / b;
    let sub = a - b;
    let add = a + b;
    let multiply = a * b;
    let expo = a ** b;
    function faulty() {
    if (c > 0.1) {
    console.log("division: ", div);
    console.log("addition: ", add);
    console.log("subtract: ", sub);
    console.log("multiply: ", multiply);
    console.log("exponational: ", expo);
    }
    else if (c < 0.1) {
    console.log("suntract: ", multiply);
    console.log("exponational ", sub);
    console.log("division: ", expo);
    console.log("add: ", div);
    console.log("mutiply: ", add);
    }
    }
    faulty()

  • @ayush.tiwarios2105
    @ayush.tiwarios2105 3 месяца назад

    00:42 Create a faulty calculator
    01:24 Create a faulty calculator using JavaScript
    02:06 A faulty calculator that performs wrong operations
    03:30 Create a faulty calculator that performs wrong operations 10% of the time
    04:12 To perform a calculation with 10% probability, generate a random number between 1 and 100.
    04:54 Checking if a number is less than 0.1
    05:31 Solve the challenge for a shoutout.

  • @smhaviary5545
    @smhaviary5545 2 месяца назад

    harry bhai ap kamal ho #challenge accepted♥

  • @ayushuniyal2586
    @ayushuniyal2586 11 месяцев назад

    5 star quality. Infact i am not a person who can rate you, you are fatr more superior than all.
    One request can you give estimate time of course completion

  • @ghulamJillani-y9z
    @ghulamJillani-y9z 7 дней назад +1

    harry bahi app ne to bataya hi nai ke js me input kese lete han

  • @RiddhiRustagi_
    @RiddhiRustagi_ 10 месяцев назад

    // Create a faulty calculator using js.
    // This faulty calculator does following :
    // 1.It takes two numbers as input from the user.
    // 2.It performes wrong operations as follows:
    // + > -
    // * > +
    // - > /
    // / >**
    // it performs wrong operator 10% of the times

    const faultyCalculator = (a, b) => {
    console.log("a is " + a);
    console.log("b is " + b);
    let random = Math.random();
    let Addition = a + b;
    let Subtraction = a - b;
    let Multiplication = a * b;
    let Division = a / b;
    let Exponentiation = a ** b;
    if (random < 0.1) {
    Addition = a - b;
    Subtraction = a / b;
    Multiplication = a + b;
    Division = a ** b;
    }
    console.log("Addition Result after faulty calculation: " + Addition);
    console.log("SubtractionResult after faulty calculation: " + Subtraction);
    console.log("MultiplicationResult after faulty calculation: " + Multiplication);
    console.log("DivisionResult after faulty calculation: " + Division);
    console.log("ExponentiationResult after faulty calculation: " + Exponentiation);
    };
    for (let i = 0; i < 5; i++) {
    faultyCalculator(1, 1);
    }

  • @SHREYASARUN-z1k
    @SHREYASARUN-z1k 11 месяцев назад +1

    Congratulation For 5Million Subscriber :)

  • @aaryantalsania
    @aaryantalsania 28 дней назад

    let a = Math.random(10);
    console.log(a);
    function add(a, b) {
    return a + b;
    }
    function subtract(a, b) {
    return a - b;
    }
    function multiply(a, b) {
    return a * b;
    }
    function divide(a, b) {
    return a / b;
    }
    if(a < 0.1){
    function add(a, b) {
    return a - b;
    }
    function subtract(a, b) {
    return a + b;
    }
    function multiply(a, b) {
    return a / b;
    }
    function divide(a, b) {
    return a * b;
    }
    }
    console.log(add(1, 2));
    console.log(subtract(1, 2));
    console.log(multiply(1, 2));
    console.log(divide(1, 2));

  • @rahathossain82
    @rahathossain82 19 дней назад

    /* Create a faulty calculator using JavaScript
    This faulty calculator does following:
    1. It takes two numbers as input from the user
    2. It perfoms wrong operations as follows:
    ◽ + ---> -
    ◽ * ---> +
    ◽ - ---> /
    ◽ / **
    ❗ It performs wrong operation 10% of the times...!
    */
    // Right calculation Function
    let rightcalc = function (a, b, c) {
    // Taking User Input
    a = Number(prompt("First Number"));
    let inp1 = Number(a);
    b = prompt("Operator: +, -, *, /, **");
    c = Number(prompt("Second Number"));
    let inp2 = Number(c);
    console.log("The first Number: " + inp1);
    console.log("Operator: " + b);
    console.log("The Second Number: " + inp2);
    // Checking the validity of the NUmber
    if (isNaN(inp1) && isNaN(inp2)) {
    console.log("Enter Valid Number");
    }
    // Start doing calculation based on inputs and operator
    if (b == "+") {
    let sum = inp1 + inp2;
    console.log(sum);
    } else if (b == "*") {
    let multiplication = inp1 * inp2;
    console.log(multiplication);
    } else if (b == "/") {
    let divide = inp1 / inp2;
    console.log(divide);
    } else if (b == "-") {
    let substract = inp1 - inp2;
    console.log(substract);
    } else if (b == "**") {
    let exponent = inp1 ** inp2;
    console.log(exponent);
    } else {
    console.log("Enter a valid Operator");
    }
    };
    //Wrong Claculation Function
    let wrongcalc = function (a, b, c) {
    // Taking User Input
    a = Number(prompt("First Number"));
    let inp1 = Number(a);
    b = prompt("Operator: +, -, *, /, **");
    c = Number(prompt("Second Number"));
    let inp2 = Number(c);
    console.log("The first Number: " + inp1);
    console.log("Operator: " + b);
    console.log("The Second Number: " + inp2);
    // Checking the validity of the NUmber
    if (isNaN(inp1) && isNaN(inp2)) {
    console.log("Enter Valid Number");
    }
    // Start doing calculation based on inputs and operator
    if (b == "+") {
    let sum = inp1 - inp2;
    console.log(sum);
    } else if (b == "*") {
    let multiplication = inp1 + inp2;
    console.log(multiplication);
    } else if (b == "/") {
    let divide = inp1 ** inp2;
    console.log(divide);
    } else if (b == "-") {
    let substract = inp1 / inp2;
    console.log(substract);
    } else if (b == "**") {
    let exponent = inp1 ** inp2;
    console.log(exponent);
    } else {
    console.log("Enter a valid Operator");
    }
    };

    // Probability checking To perform the right/wrong calculation

    let c = Math.random();
    if (c < 0.1) {
    console.log("10% Probability Matches");
    wrongcalc();
    } else {
    console.log("10% Probability Does Not Match");
    rightcalc();
    }
    console.log(`Probability : ${c}`);

  • @raghavgupta9938
    @raghavgupta9938 6 месяцев назад

    var a = 12
    var b = 3
    var operation = 2;
    // var a = prompt("Enter a number:");
    // var b = prompt("Enter a number:");
    // var operation = prompt("What operation do you want to do? 1:Add 2:Subtract 3:Multiply 4:Divide")
    let fault = Math.random();
    function sum(a, b) {
    return a + b;
    }
    function diff(a, b) {
    return a - b;
    }
    function pro(a, b) {
    return a * b;
    }
    function expo(a, b) {
    return a ** b;
    }
    function slash(a, b) {
    return a / b;
    }
    if (fault > 0.1) {
    switch (operation) {
    case 1:
    console.log(sum(a, b));
    break;
    case 2:
    console.log(diff(a, b));
    break;
    case 2:
    console.log(pro(a, b));
    break;
    case 2:
    console.log(slash(a, b));
    break;
    }
    }
    else {
    switch (operation) {
    case 1:
    console.log(diff(a, b));
    break;
    case 2:
    console.log(slash(a, b));
    break;
    case 2:
    console.log(sum(a, b));
    break;
    case 2:
    console.log(expo(a, b));
    break;
    }
    }

  • @PushV-m2v
    @PushV-m2v Месяц назад

    this is the answer
    note: download prompt sync module first by running npm install prompt-sync
    in the terminal
    // create a faulty calculator using js
    // this faulty calculator does following
    // 1. It takes two numbers as input from the user
    // 2. it performs wrong operations
    // + -> -
    // * -> +
    // - -> /
    // / -> **
    // it performs 10% of wrong operation
    const prompt = require("prompt-sync")();
    let a = Number(prompt("Enter your number 1 "));
    let b = Number(prompt("Enter your number 2 "));
    // Random Number
    let random = Math.random();
    let addition = a+b ;
    let Subtraction = a-b;
    let Multiplication =a*b;
    let Division= a/b;
    let Exponentiation = a**b;
    // Condition
    if (random

  • @prohegde006
    @prohegde006 3 месяца назад

    Sigma Batch OP
    HArry Bhai OP

  • @JaineePatel-mm7vm
    @JaineePatel-mm7vm 6 месяцев назад +1

    faulty calculator ready

  • @vivekraghuwanshi9756
    @vivekraghuwanshi9756 6 месяцев назад

    Challenge Accepted!!......Nice Videos Bhaiya ;)

  • @VanshDeshwal0
    @VanshDeshwal0 11 месяцев назад +1

    Challenge Accepted Harry Bhai 🔥🔥#HarryBhai #SigmaBatchOp

  • @nomaanrizvi6561
    @nomaanrizvi6561 3 месяца назад

    /* Create a faulty calculator using JavaScript
    This faulty calculator does following:
    1. It takes two numbers as input from the user
    2. It perfoms wrong operations as follows:
    + ---> -
    * ---> +
    - ---> /
    / ---> **
    It performs wrong operation 10% of the times
    */
    const prompt = require('prompt-sync')();
    let i=Math.random()
    function faulty_caclulater(a,b){
    let operation=prompt('choose between: +, -, *, / ')
    if (i

  • @fscraftsgamingworld4591
    @fscraftsgamingworld4591 11 месяцев назад

    Very close to 5 million subscribers

  • @Infinity-vc7rx
    @Infinity-vc7rx 10 месяцев назад

    #ChallangeAccepted
    #HarryBahi lovE yoU sO mucH FOr thiS Course This is a Market best course in web Development.

  • @continnum_radhe-radhe
    @continnum_radhe-radhe 11 месяцев назад +1

    Thank you ❤

  • @cosecseccot
    @cosecseccot 10 месяцев назад +1

    for 10% probability,
    math.random should be

  • @ahmadbilal7164
    @ahmadbilal7164 11 месяцев назад

    Advance congrats for having 5M followers🥰🥰

  • @saurabhsoni4325
    @saurabhsoni4325 Месяц назад

    HARRY BHAI OP

  • @bhavanitelecom
    @bhavanitelecom 8 месяцев назад

    Code For Faulty Calculator :
    let c =Math.random();
    function add(a,b){
    if(c

  • @Pranjal-fx9ys
    @Pranjal-fx9ys 11 месяцев назад +3

    Challenge Accepted👍
    #SigmaBatch
    #op
    //User Input Here..
    let first =2;
    let second=1;
    //Code
    let mathrandom = Math.random()
    if(mathrandom

  • @Learnprogramming-q7f
    @Learnprogramming-q7f 7 месяцев назад

    thank you Bhaiya

  • @bebetterwithansh
    @bebetterwithansh 5 месяцев назад

    I am a lil late but anyways heres the code for the faulty calculator
    let i=0;
    // adding a while loop to make the program repeatable
    while (i

  • @RohitGupta-d5r
    @RohitGupta-d5r Месяц назад

    #ChallengeAccepted
    #Solution: I used prompt to get the values by user and created two functions with switch case & using if-else statement only one of them will run :-
    let a = prompt("Enter first number");
    let b = prompt("Enter Second number");
    let operator = prompt("Enter operator (+,-,*,/)");
    function calculator(a,b) {
    a = Number(a);
    b = Number(b);
    switch (operator) {
    case '+' :
    return a+b;
    break;
    case '-' :
    return a-b;
    break;
    case '*' :
    return a*b;
    break;
    case "/" :
    return a/b;
    break;
    default:
    break;
    }
    }
    function faultyCalculator(a,b) {
    a = Number(a);
    b = Number(b);
    switch (operator) {
    case '+' :
    return a-b;
    break;
    case '-' :
    return a/b;
    break;
    case '*' :
    return a-b;
    break;
    case "/" :
    return a**b;
    break;
    default:
    break;
    }
    }
    let prob = Math.random();
    if(prob

  • @sahilmaharjan4010
    @sahilmaharjan4010 3 месяца назад

    SIgma Batch OP⭐⭐⭐⭐⭐

  • @anshdholakiya7606
    @anshdholakiya7606 11 месяцев назад

    Happy 5M harry bhai❤❤❤❤❤❤❤❤❤❤

  • @ailascommentatory9716
    @ailascommentatory9716 11 месяцев назад

    solved exercise:
    (It is made to run in browser but with few modifications, it can run in terminal Aswell).
    let probability = Math.random()
    let a = parseInt(prompt("Enter your first number: "))
    let o = prompt("Enter operator: ")
    let b = parseInt(prompt("Enter your second number: "))
    if (probability < 0.1){
    faulty(a, b,o)
    }
    else {
    correct(a,b,o)
    }
    function correct(a,b,o) {
    if(o=="+"){
    console.log((a)+(b));
    }
    else if(o=="-"){
    console.log(a-b);
    }
    else if(o=="*"){
    console.log(a*b);
    }
    else{
    console.log(a/b);
    }
    }
    function faulty(a,b,o) {
    if(o=="+"){
    console.log(a-b);
    }
    else if(o=="-"){
    console.log(a/b);
    }
    else if(o=="*"){
    console.log(a+b);
    }
    else{
    console.log(a**b);
    }
    }

  • @VaapZy
    @VaapZy 7 месяцев назад

    The input numbers can be made with prompt or input by replacing the declaration variables
    let a = Math.random();
    let x = 10;
    let y = 20;
    let operator = "-";
    function calc(x, y, operator) {
    if (operator == "+") {
    console.log(x + y);
    } else if (operator == "-") {
    console.log(x - y);
    } else if (operator == "*") {
    console.log(x * y);
    } else if (operator == "/") {
    console.log(x / y);
    } else {
    console.log("Invalid operator");
    }
    }
    function faultCalc(x, y, operator) {
    if (operator == "+") {
    console.log(x - y);
    } else if (operator == "-") {
    console.log(x / y);
    } else if (operator == "*") {
    console.log(x + y);
    } else if (operator == "/") {
    console.log(x ** y);
    } else {
    console.log("Invalid operator");
    }
    }
    if (a < 0.1) {
    faultCalc(x, y, operator);
    } else {
    calc(x, y, operator);
    }

  • @atharvdaware
    @atharvdaware 11 месяцев назад +8

    Challenge Accepted
    var a = Number(prompt("Enter your number 1 "));
    var b = Number(prompt("Enter your number 2 "));
    let rand = Math.random()
    var result = a+b ;
    if (rand

    • @abdulsamadsiddiqui1649
      @abdulsamadsiddiqui1649 11 месяцев назад +1

      oh i could do that in 1 if i created seperate "if" like this but it is working thu
      let a=10
      let b=2
      let rand=Math.random()
      if(rand

  • @musicxlibrary4185
    @musicxlibrary4185 3 месяца назад

    Done after an hour of struggle
    FACULTY CALCULATOR
    do {
    var num1 = prompt("Enter first integer:");
    var num2 = prompt("Enter second integer:");
    let a = Math.floor(Math.random() * 100);
    if (a > 10) {
    good_calc(num1, num2);
    } else {
    faulty_calc(num1, num2);
    }
    function good_calc(x, y) {
    let ans = prompt(
    "Which operation do you like to perform?
    1)Add
    2)Subtract
    3)Multiplication
    4)Division"
    );
    if (ans == 1) {
    let fans = +x + +y;
    console.log("Your answer is " + fans);
    } else if (ans == 2) {
    let fans = +x - +y;
    console.log("Your answer is " + fans);
    } else if (ans == 3) {
    let fans = +x * +y;
    console.log("Your answer is " + fans);
    } else if (ans == 4) {
    let fans = +x / +y;
    console.log("Your answer is " + fans);
    } else {
    console.log("Incorrect operation!!!");
    }
    }
    function faulty_calc(x, y) {
    let ans = prompt(
    "Which operation do you like to perform?
    1)Add
    2)Subtract
    3)Multiplication
    4)Division"
    );
    if (ans == 1) {
    let fans = +x - +y;
    console.log("Your answer is " + fans);
    } else if (ans == 2) {
    let fans = +x / +y;
    console.log("Your answer is " + fans);
    } else if (ans == 3) {
    let fans = +x + +y;
    console.log("Your answer is " + fans);
    } else if (ans == 4) {
    let fans = +x / +y;
    console.log("Your answer is " + fans);
    } else {
    console.log("Incorrect operation!!!");
    }
    }
    var ques = prompt("do you want to perform another operation?
    1)yes
    2)no");
    } while (ques == 1);

  • @Viishal05
    @Viishal05 5 месяцев назад

    Challenge accepted Harry Bhai
    This is code:
    let a = Number(prompt("Enter the first number:"));
    let b = Number(prompt("Enter the second number:"))
    let random = Math.random();
    let addition = a + b;
    let subtraction = a - b;
    let multiplication = a * b;
    let division = a / b;
    let Exponention = a ** b;
    if (random < 0.1) {
    console.log("addition calculation:", a - b);
    console.log("subtraction calculation:", a / b);
    console.log("multiplication calculation:", a + b);
    console.log("division calculation:", a * b);
    console.log("Exponention calculation:", a ** b);
    } else {
    console.log("addition calculation:", a + b);
    console.log("subtraction calculation:", a - b);
    console.log("multiplication calculation:", a * b);
    console.log("division calculation:", a / b);
    console.log("exponentiation calculation:", a ** b);
    }

  • @user-sololeveling
    @user-sololeveling 5 месяцев назад

    this is the best course

  • @Treatjunction
    @Treatjunction 11 месяцев назад

    here i multiply math random into ten so it genrates random number between 1 to 10
    let x = Math.random()*10
    console.log(x) // this line is only for checking random numbers are generating properly or not
    let inp1 = 4
    let inp2 = 6
    let op = "+"
    if(x

  • @webtrex5369
    @webtrex5369 11 месяцев назад

    let a = parseInt(prompt('Enter first number :'))
    let b = parseInt(prompt('Enter second number :'))
    console.log(a,b)
    let randInt = Math.floor(Math.random() * 100);
    console.log(randInt)
    function FaultyCalc(firstnumber, secondnumber) {
    console.log('Addition of the first and second number is ' + (a-b) )
    console.log('Multiplication of the first and second number is ' + (a+b) )
    console.log('Subtraction of the first and second number is ' + (a/b) )
    console.log('Division of the first and second number is ' + (a**b) )
    }
    function TruelyCalc(firstnumber, secondnumber) {
    console.log('Addition of the first and second number is ' + (a+b) )
    console.log('Multiplication of the first and second number is ' + (a*b) )
    console.log('Subtraction of the first and second number is ' + (a-b) )
    console.log('Division of the first and second number is ' + (a/b) )
    }
    if(randInt

  • @bhishek_
    @bhishek_ 11 месяцев назад

    Congratulations for 5M in advance ❤🎉

  • @Harsh.cool.programmer
    @Harsh.cool.programmer 10 месяцев назад

    Users Input kaise lete hai Is par bhi ek Video Banye @CodeWithHarry

  • @aishvloger450
    @aishvloger450 6 месяцев назад

    done
    // craete a faulty calculator using javsscript
    let a = parseInt(prompt("enter the first number"));
    let b = parseInt(prompt("enter the second number"));
    let random = Math.random();
    let addition = a+b;
    let subtractiom = a-b;
    let multiplication = a*b;
    let division = a/b;
    if(random < 0.1){
    console.log("addition calculation:",a-b);
    console.log("subtraction calculation:",a+b);
    console.log("multiplication calculation:",a/b);
    console.log("division calculation:",a*b);
    }
    else {
    console.log("addition calculation:",a+b);
    console.log("subtraction calculation:",a-b);
    console.log("multiplication calculation:",a*b);
    console.log("division calculation:",a/b);
    }

  • @mukundamondal9199
    @mukundamondal9199 6 месяцев назад

    challenge accepted harry bhai
    #solution
    function faultyCalculator(operator, operand1, operand2) {
    const operators = {
    "+": (a, b) => a - b,
    "-": (a, b) => a / b,
    "*": (a, b) => a + b,
    "/": (a, b) => a ** b,
    };
    // check the operator is valid
    if (!operators[operator]) {
    return "Invalid operator";
    }
    // Perform the calculation
    let result;
    if (Math.random() < 0.1) {
    result = Math.random() * 1000;
    } else {
    result = operators[operator](operand1, operand2);
    }
    return result;
    }
    const operator = '*';
    const operand1 = 5;
    const operand2 = 3;
    const result = faultyCalculator(operator, operand1, operand2);
    console.log(result);

  • @AmeerHamza-l1e4x
    @AmeerHamza-l1e4x 11 месяцев назад

    // Function to perform faulty calculations
    function faultyCalculator(operator, num1, num2) {
    let result;
    // Check the operator and perform the corresponding operation
    if (operator === '+') {
    result = num1 - num2; // Faulty addition
    } else if (operator === '-') {
    result = num1 + num2; // Faulty subtraction
    } else if (operator === '*') {
    result = num1 / num2; // Faulty multiplication
    } else if (operator === '/') {
    result = num1 * num2; // Faulty division
    } else {
    return "Invalid operator";
    }
    return result;
    }
    // Example usage
    var operator = '+';
    var num1 = 5;
    var num2 = 3;
    var result = faultyCalculator(operator, num1, num2);
    console.log(`${num1} ${operator} ${num2} = ${result}`);
    var operator = '-';
    var num1 = 5;
    var num2 = 3;
    var result = faultyCalculator(operator, num1, num2);
    console.log(`${num1} ${operator} ${num2} = ${result}`);
    var operator = '*';
    var num1 = 5;
    var num2 = 3;
    var result = faultyCalculator(operator, num1, num2);
    console.log(`${num1} ${operator} ${num2} = ${result}`);
    var operator = '/';
    var num1 = 5;
    var num2 = 3;
    var result = faultyCalculator(operator, num1, num2);
    console.log(`${num1} ${operator} ${num2} = ${result}`);

  • @sambhavjain1249
    @sambhavjain1249 26 дней назад

    #HarryBhai done Exercise 9 just taken some extra help as I was getting error again and again
    // Faulty Calculator
    console.log("Welcome to Faulty Calculator")
    if (Math.random() < 0.1) {
    function sum(a, b) {
    return (a - b)
    }
    function subtraction(a, b) {
    return (a / b)
    }
    function multiplication(a, b) {
    return (a + b)
    }
    function divide(a, b) {
    return (a ** b)
    }
    }
    else {
    function sum(a, b) {
    return (a + b)
    }
    function subtraction(a, b) {
    return (a - b)
    }
    function multiplication(a, b) {
    return (a * b)
    }
    function divide(a, b) {
    return (a / b)
    }
    }
    let q = sum(2, 3)
    let r = subtraction(5, 3)
    let s = multiplication(10, 8)
    let t = divide(30, 4)
    console.log(q)
    console.log(r)
    console.log(s)
    console.log(t)

  • @clashingtv2527
    @clashingtv2527 11 месяцев назад

    Pre congratulations for 5m🎉

  • @muhammadwaeeem2349
    @muhammadwaeeem2349 11 месяцев назад

    Sigma Batch Op❤❤❤❤❤

  • @sadiyafirdouspatel620
    @sadiyafirdouspatel620 8 месяцев назад

    #Challenge accepted
    #SigmaBatchOp
    Loving the course

  • @marufimtiazmahir2396
    @marufimtiazmahir2396 11 месяцев назад

    Sigma Batch OP

  • @captaingaming8850
    @captaingaming8850 28 дней назад

    #day5 well! Challenge accepted even executed.

  • @harsh1740x
    @harsh1740x 11 месяцев назад

    jald hi pahuchunga yaha tak😉

  • @ashrit39
    @ashrit39 11 месяцев назад

    Congratulations for 5M🎉🎉🎉🎉🎉❤❤❤❤❤❤❤ Lots Of Love #sigma

  • @VishalKumar-ex1gp
    @VishalKumar-ex1gp 11 месяцев назад +1

    Sir ek video aap website se pesha kesha aata hai kitna aata hai iss completely information de di please sir kitna views pr kitna milta hai all detiall

  • @NIMahin
    @NIMahin 11 месяцев назад

    Challange accepted
    harry vai, i can't understand the using of Math.random() in this faulty calculator
    faulty calculator code here:
    let a = prompt("enter the value of a:")
    let operators = prompt("enter the operator:")
    let b = prompt("enter the value of b:")
    a = parseInt(a)
    b = parseInt(b)
    const addInverse = (a, b) => {
    return a - b
    }
    const multiplyInverse = (a, b) => {
    return a + b
    }
    const divideInverse = (a, b) => {
    return a ** b
    }
    const substractInverse = (a, b) => {
    return a / b
    }
    if(operators == '+'){
    console.log(addInverse(a, b))
    }
    else if(operators == '*'){
    console.log(multiplyInverse(a, b))
    }
    else if(operators == '/'){
    console.log(divideInverse(a, b))
    }
    else if(operators == '-'){
    console.log(substractInverse(a, b))
    }
    else{
    console.log('invalid input')
    }

  • @triggeredarmy3284
    @triggeredarmy3284 11 месяцев назад

    challenge accepted and the answer is
    let num1 = prompt("Please enter the number1"); num1=num1*1;
    let num2 = prompt("Please enter the number2");num2=num2*1;
    let operator = prompt("Please enter the operator");
    if (Math.random()>0.1){
    if (operator == "+" ){
    alert(num1+num2);
    }
    else if (operator == "-" ){
    alert(num1-num2);
    }
    else if (operator == "*" ){
    alert(num1*num2);
    }
    else if (operator == "/" ){
    alert(num1/num2);
    }
    }
    else {
    if (operator == "+" ){
    alert(num1-num2);
    }
    else if (operator == "-" ){
    alert(num1/num2);
    }
    else if (operator == "*" ){
    alert(num1+num2);
    }
    else if (operator == "/" ){
    alert(num1**num2);
    }
    }
    please tell ne if this is correct or not..???

  • @muhammadasad2184
    @muhammadasad2184 11 месяцев назад

    Sigma Batch OP ❤

  • @ShaheenShaikh22028
    @ShaheenShaikh22028 Месяц назад

    Challenge accepted!
    let num1 = prompt("Enter first number");
    num1 = Number.parseInt(num1);
    let num2 = prompt("Enter second number:");
    num2 = Number.parseInt(num2);
    let rand = Math.random();
    if (rand < 0.1) {
    console.log("Addition is:" + num1 - num2);
    console.log("Multiplication is:" + num1 + num2);
    console.log("Subtraction is:" + num1 / num2);
    console.log("division is:" + num1 ** num2);
    }
    else {
    console.log("Addition is:" + num1 +num2);
    console.log("Multiplication is:" + num1 * num2);
    console.log("Subtraction is:" + num1 - num2);
    console.log("division is:" + num1 / num2);
    }

  • @Harsh.cool.programmer
    @Harsh.cool.programmer 10 месяцев назад

    Users Input kaise lete hai Is par bhi ek Video Banye @codewithharry

  • @nileshtayade3546
    @nileshtayade3546 4 месяца назад

    Thank you for course it is very good.
    function faultycal(a,b,op){
    switch(op)
    {
    case '+': console.log(a-b); break;
    case '-': console.log(a+b); break;
    case '*': console.log(a/b); break;
    case '/': console.log(a*b); break;
    }
    }
    function normalcal(a,b,op){
    switch(op)
    {
    case '+': console.log(a+b); break;
    case '-': console.log(a-b); break;
    case '*': console.log(a*b); break;
    case '/': console.log(a/b); break;
    }
    }
    let a=10;
    let b=10;
    let op='+';
    let isfaulty=Math.random();
    if(isfaulty

  • @siddyverse7447
    @siddyverse7447 4 месяца назад

    challenge done sirrr

  • @RohanDasRD
    @RohanDasRD 11 месяцев назад

    Amazing Bhai

  • @samratdey2284
    @samratdey2284 5 месяцев назад

    If anybody got time, I suggest turning on the caption at 4:16 you might see something interesting.

  • @uzairkhan8998
    @uzairkhan8998 11 месяцев назад

    Sir sir sir !!!!! IMPORTANT QUESTION ❓ Kia AI programmers ki jagah lelega ??
    Sir please answer me 😨🙏 !!! Please 😭
    ❤️ ❤️

  • @studywithme4599
    @studywithme4599 Месяц назад

    challenge accepted :
    let A = Math.random();
    const faulty1 = (a, b) => {
    if (A < 0.1) {
    return a - b;
    }
    else {
    return a + b;
    }
    }
    let addition = faulty1(2, 3);
    console.log("The addition of two numbers is:", addition);
    const faulty2 = (a, b) => {
    if (A < 0.1) {
    return a / b;
    }
    else {
    return a - b;
    }
    }
    let substraction = faulty2(9, 3);
    console.log("The substraction of two numbers is:", substraction);
    const faulty3 = (a, b) => {
    if (A < 0.1) {
    return a + b;
    }
    else {
    return a * b;
    }
    }
    let Multiplication = faulty3(3, 4);
    console.log("The multiplication of the two numbers is:", Multiplication);
    const faulty4 = (a, b) => {
    if (A < 0.1) {
    return a ** b;
    }
    else {
    return a / b;
    }
    }
    let Division = faulty4(3, 4);
    console.log("The multiplication of the two numbers is:", Division);

  • @hossain9410
    @hossain9410 9 месяцев назад

    Please explain about the 10 percentage thing again. I didn't get that. Thank u

  • @yuvrj3560
    @yuvrj3560 11 месяцев назад

    #Challengeaccepted very nice harry bhaiya

  • @xyXCG364hhgs
    @xyXCG364hhgs Месяц назад

    // A faulty calculator which shows incorrect calc at 10% of calculations
    let a = 5;
    let b = 2;
    if(Math.random()

  • @adarshgupta_14
    @adarshgupta_14 7 месяцев назад +1

    function faultycalc(a, b, c) {
    let x = Math.random();
    if (x < 0.1) {
    switch (c) {
    case 1:
    substraction(a, b);
    break;
    case 2:
    divide(a, b);
    break;
    case 3:
    add(a, b);
    break;
    case 4:
    exponent(a, b);
    break;
    default: console.log("Invalid Input");
    break;
    }
    }
    else {
    switch (c) {
    case 1:
    add(a, b);
    break;
    case 2:
    substraction(a, b);
    break;
    case 3:
    multiply(a, b);
    break;
    case 4:
    divide(a, b);
    break;
    default: console.log("Invalid Input");
    break;
    }
    }
    }
    function add(a, b) {
    console.log(a + b);
    }
    function substraction(a, b) {
    console.log(a - b);
    }
    function multiply(a, b) {
    console.log(a * b);
    }
    function divide(a, b) {
    console.log(a / b);
    }
    function exponent(a, b) {
    console.log(a ** b);
    }
    faultycalc(5, 3, 1);
    faultycalc(5, 3, 2);
    faultycalc(5, 3, 3);
    faultycalc(5, 3, 4);
    faultycalc(5, 3, 5);