Skip to content

Commit

Permalink
Done!
Browse files Browse the repository at this point in the history
  • Loading branch information
26-PM committed Nov 26, 2023
1 parent e41a469 commit 683fe6b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Faulty Calculator</title>
<style>
*{
background-color:black;
color:white;
}
</style>
</head>
<body>
<script src="index.js"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
a=prompt("Enter first number:")
b=prompt("Enter second number:")
c=prompt("Enter operation:")

let obj={
"+":"-",
"*":"+",
"-":"/",
"/":"**",
}

random=Math.random()

if (random>0.1){
alert(`The Result is ${eval(`${a} ${c} ${b}`)}`)
}
else{
c=obj[c]
alert(`The Result is ${eval(`${a} ${c} ${b}`)}`)
}

0 comments on commit 683fe6b

Please sign in to comment.