coin toss game using javascript
Program 1 <html> <head><title>Coin Toss Game </title> <script type=”text/javascript”> function coin_toss_game() { let userchoice,compchoice userchoice=parseInt(document.getElementById(“txtuserchoice”).value) compchoice=Math.floor(Math.random()*2) if(userchoice==1 || userchoice==2) { if(compchoice==1) document.writeln(“<center><font color=green size=7>Its a Head…!</font><</center>>”) else document.writeln(“<center><font color=green size=7>Its a Tail…!</font></center>”) if(userchoice==1 &&...
Program 1 //Coin Toss Game(Console Application) “use strict” const ps=require(“prompt-sync”) const prompt=ps({sigint:true}) let choice let compchoice,userchoice do { compchoice=Math.floor(Math.random()*2) console.log(“———Coin Toss Game————-“) console.log(“\t\t 1.Head \n\t\t 2.Tail “) console.log(“—————————————-“) userchoice=parseInt(prompt(“Enter Users Choice: “)) // console.log(“User...
Program 1 <html> <head><title>Coin Toss Game </title> <script type=”text/javascript”> function coin_toss_game() { let userchoice,compchoice compchoice=Math.floor(Math.random()*2) // alert(compchoice) userchoice=parseInt(document.getElementById(“txtuser”).value) if(userchoice==1 || userchoice==2) { if(compchoice==1) document.writeln(“<font color=green size=7>Its a Head….!</font>”) else document.writeln(“<font color=red size=7>Its a Tail….!</font>”)...
Program 1 // Coin Toss Game (Console Application) “use strict” const ps=require(“prompt-sync”) const prompt=ps({sigint:true}) //console.log(Math.random()) let choice let compchoice,userchoice do { compchoice=Math.floor(Math.random() * 2) console.log(“———-Coin Toss Game————“) console.log(“\t \t 1. Head \n\t\t 2. Tail”)...