From 99324af021045c5568fa6ffdd8e72bd3224fef76 Mon Sep 17 00:00:00 2001 From: gautami1554 Date: Sun, 13 Dec 2020 21:22:57 +0530 Subject: [PATCH] assignment 1 and 2 submission --- Session-2/max2.js | 10 ++++++++++ Session-2/max3.js | 18 ++++++++++++++++++ Session-2/min2.js | 0 Session-2/triangle.js | 15 +++++++++++++++ Session-2/triangle2.js | 8 ++++++++ Session-2/variable.js | 9 +++++++++ Session-2/vowel.js | 7 +++++++ 7 files changed, 67 insertions(+) create mode 100644 Session-2/max2.js create mode 100644 Session-2/max3.js create mode 100644 Session-2/min2.js create mode 100644 Session-2/triangle.js create mode 100644 Session-2/triangle2.js create mode 100644 Session-2/variable.js create mode 100644 Session-2/vowel.js diff --git a/Session-2/max2.js b/Session-2/max2.js new file mode 100644 index 0000000..aef8f93 --- /dev/null +++ b/Session-2/max2.js @@ -0,0 +1,10 @@ +var x=4; +var y=7; +console.log("x=",x); +console.log("y=",y); +if(y>x){ + console.log("y is larger"); +} +else{ + console.log("x is larger"); +} \ No newline at end of file diff --git a/Session-2/max3.js b/Session-2/max3.js new file mode 100644 index 0000000..e37fcc5 --- /dev/null +++ b/Session-2/max3.js @@ -0,0 +1,18 @@ +var x=9; +var y=2; +var z=5; +console.log("x=",x); +console.log("y=",y); +console.log("z=",z); +if(x>y && x>z){ + console.log(x); +} +elif(y>z && y>x){ + console.log(y); +} +elif(z>y && z>x){ + console.log(z); +} +else{ + console.log("none") +} \ No newline at end of file diff --git a/Session-2/min2.js b/Session-2/min2.js new file mode 100644 index 0000000..e69de29 diff --git a/Session-2/triangle.js b/Session-2/triangle.js new file mode 100644 index 0000000..5f6c3dd --- /dev/null +++ b/Session-2/triangle.js @@ -0,0 +1,15 @@ +var a=windows.prompt("Enter your first angle:"); +var a=parseInt("10"); +alert("first angle"+ a); +var b=windows.prompt("Enter your second angle:"); +var b=parseInt("10"); +alert("second angle"+ b); +var c=windows.prompt("Enter your third angle:"); +var c=parseInt("10"); +alert("third angle"+ c); +if(a+b+c==180){ + console.log("Triangle is valid"); +} +else{ + console.log("Triangle is inavlid"); +} diff --git a/Session-2/triangle2.js b/Session-2/triangle2.js new file mode 100644 index 0000000..aaee6f7 --- /dev/null +++ b/Session-2/triangle2.js @@ -0,0 +1,8 @@ +var a=windows.prompt("Enter your first angle:"); +var a=parseInt("10"); +alert("first angle"+ a); +var b=windows.prompt("Enter your second angle:"); +var b=parseInt("10"); +alert("second angle"+ b); +var z=180-(x+y) +console.log(z) diff --git a/Session-2/variable.js b/Session-2/variable.js new file mode 100644 index 0000000..3cd3c05 --- /dev/null +++ b/Session-2/variable.js @@ -0,0 +1,9 @@ +var x=windows.prompt("Enter your number:"); +var x=parseInt("10"); +console.log("x=",x); +if(x%2==0){ + console.log("x is even"); +} +else{ + console.log("x is odd"); +} \ No newline at end of file diff --git a/Session-2/vowel.js b/Session-2/vowel.js new file mode 100644 index 0000000..868354d --- /dev/null +++ b/Session-2/vowel.js @@ -0,0 +1,7 @@ +var character = windows.prompt("Enter a character:"); +if (character == 'a' || character == 'A' || character == 'e' || character == 'E' || character == 'i' || character == 'I' || character == 'o' || character == 'O' || character == 'u' || character == 'U') { +console.log("Its a vowel"); +} +else { + console.log("Its a consonant"); +} \ No newline at end of file