From 2bedb215f0c632184daa9d5c201609f129e52d16 Mon Sep 17 00:00:00 2001 From: Vijay Date: Tue, 29 Aug 2017 10:22:55 +0530 Subject: [PATCH] Adde my assignments --- HTML/Closestpower.html | 14 ++++++++ HTML/Factorial.html | 14 ++++++++ HTML/ListOfPairs.html | 14 ++++++++ HTML/Multiples.html | 14 ++++++++ HTML/PalindromeList.html | 13 ++++++++ HTML/PalindromeTest.html | 14 ++++++++ HTML/ReadMe.txt | 51 ++++++++++++++++++++++++++++ HTML/Repeated_Numbers_List.html | 13 ++++++++ HTML/SumPaid.html | 13 ++++++++ HTML/Sum_Natural_No.html | 14 ++++++++ HTML/SumofMultiples.html | 14 ++++++++ JS/closestPower.js | 17 ++++++++++ JS/factorial.js | 15 +++++++++ JS/listOfPairs.js | 22 ++++++++++++ JS/multiples.js | 37 +++++++++++++++++++++ JS/palindromeTest.js | 59 +++++++++++++++++++++++++++++++++ JS/repeatedNumbers.js | 39 ++++++++++++++++++++++ JS/sum.js | 15 +++++++++ JS/sumOfMultiples.js | 22 ++++++++++++ JS/totalSumPaid.js | 15 +++++++++ 20 files changed, 429 insertions(+) create mode 100644 HTML/Closestpower.html create mode 100644 HTML/Factorial.html create mode 100644 HTML/ListOfPairs.html create mode 100644 HTML/Multiples.html create mode 100644 HTML/PalindromeList.html create mode 100644 HTML/PalindromeTest.html create mode 100644 HTML/ReadMe.txt create mode 100644 HTML/Repeated_Numbers_List.html create mode 100644 HTML/SumPaid.html create mode 100644 HTML/Sum_Natural_No.html create mode 100644 HTML/SumofMultiples.html create mode 100644 JS/closestPower.js create mode 100644 JS/factorial.js create mode 100644 JS/listOfPairs.js create mode 100644 JS/multiples.js create mode 100644 JS/palindromeTest.js create mode 100644 JS/repeatedNumbers.js create mode 100644 JS/sum.js create mode 100644 JS/sumOfMultiples.js create mode 100644 JS/totalSumPaid.js diff --git a/HTML/Closestpower.html b/HTML/Closestpower.html new file mode 100644 index 0000000..afcee6d --- /dev/null +++ b/HTML/Closestpower.html @@ -0,0 +1,14 @@ + + + + +Closest power of 2 + + + +
+Enter Number : + +
+ + \ No newline at end of file diff --git a/HTML/Factorial.html b/HTML/Factorial.html new file mode 100644 index 0000000..cfadfd9 --- /dev/null +++ b/HTML/Factorial.html @@ -0,0 +1,14 @@ + + + + +Factorial Calculation + + + +
+Enter Number : + +
+ + \ No newline at end of file diff --git a/HTML/ListOfPairs.html b/HTML/ListOfPairs.html new file mode 100644 index 0000000..185da11 --- /dev/null +++ b/HTML/ListOfPairs.html @@ -0,0 +1,14 @@ + + + + +Sum of pairs equal to 8 + + + +
+Enter Number : + +
+ + \ No newline at end of file diff --git a/HTML/Multiples.html b/HTML/Multiples.html new file mode 100644 index 0000000..dddadbc --- /dev/null +++ b/HTML/Multiples.html @@ -0,0 +1,14 @@ + + + + +Replacing Multiples with String + + + +
+Enter Number : + +
+ + \ No newline at end of file diff --git a/HTML/PalindromeList.html b/HTML/PalindromeList.html new file mode 100644 index 0000000..704a952 --- /dev/null +++ b/HTML/PalindromeList.html @@ -0,0 +1,13 @@ + + + + +Palindrome Test + + + +
+ +
+ + \ No newline at end of file diff --git a/HTML/PalindromeTest.html b/HTML/PalindromeTest.html new file mode 100644 index 0000000..637e9ef --- /dev/null +++ b/HTML/PalindromeTest.html @@ -0,0 +1,14 @@ + + + + +Palindrome Test + + + +
+Enter String Value : + +
+ + \ No newline at end of file diff --git a/HTML/ReadMe.txt b/HTML/ReadMe.txt new file mode 100644 index 0000000..1e63d64 --- /dev/null +++ b/HTML/ReadMe.txt @@ -0,0 +1,51 @@ +Git Configurations for adding username and Mail id + +git config --global user.name "Sam Smith" +git config --global user.email sam@example.com + +Command for Git Initialization : +git init + + + + +Git SSL certificates Validation Command: + +git config http.sslVerify "false" + + +Git Push command + +git remote add origin https://github.com/vijayella/AngularJS.git +git remote add origin https://github.com/vijayella/Angular-Training +git push -u origin master + + +For cloning the Git hub after disabling the SSl certificates : + +git config --global http.sslVerify false +git clone https://github.com/vijayella/Angular-Training.git <> + +Changing the branch + +Git checkout + +Commiting to the git + +git commit -m "Message that describing the git commit" + + + +INstalling Node Package Manager. + +node -v +npm -v + +npm install - g typescript +npm install -g @angular/cli + + + + + + diff --git a/HTML/Repeated_Numbers_List.html b/HTML/Repeated_Numbers_List.html new file mode 100644 index 0000000..9979daf --- /dev/null +++ b/HTML/Repeated_Numbers_List.html @@ -0,0 +1,13 @@ + + + + +Repeated Numbers + + + +
+ +
+ + \ No newline at end of file diff --git a/HTML/SumPaid.html b/HTML/SumPaid.html new file mode 100644 index 0000000..a86be61 --- /dev/null +++ b/HTML/SumPaid.html @@ -0,0 +1,13 @@ + + + + +Sum Paid + + + +
+ +
+ + \ No newline at end of file diff --git a/HTML/Sum_Natural_No.html b/HTML/Sum_Natural_No.html new file mode 100644 index 0000000..a6a9150 --- /dev/null +++ b/HTML/Sum_Natural_No.html @@ -0,0 +1,14 @@ + + + + +Sum of natural numbers + + + +
+Enter Number : + +
+ + \ No newline at end of file diff --git a/HTML/SumofMultiples.html b/HTML/SumofMultiples.html new file mode 100644 index 0000000..2012e87 --- /dev/null +++ b/HTML/SumofMultiples.html @@ -0,0 +1,14 @@ + + + + +Sum of Multiples of 3 or 5 + + + +
+Enter Number : + +
+ + \ No newline at end of file diff --git a/JS/closestPower.js b/JS/closestPower.js new file mode 100644 index 0000000..dc3ff59 --- /dev/null +++ b/JS/closestPower.js @@ -0,0 +1,17 @@ +function closestPower(){ +var result=0; +var num= document.getElementById("sum").value; +if(num) +{ +document.write("Closest Power of 2 below "+ num +" is : "); + + + result = Math.pow( 2, Math.floor( Math.log( num ) / Math.log( 2 ) ) ); + +document.write(result); +} +else{ +alert("Enter valid number"); + +} +} \ No newline at end of file diff --git a/JS/factorial.js b/JS/factorial.js new file mode 100644 index 0000000..937242a --- /dev/null +++ b/JS/factorial.js @@ -0,0 +1,15 @@ +function factorial(){ +var result=1; +var num= document.getElementById("fct").value; +if(num) +{ +for(i=1;i<=num;i++){ + result=result*i; +} +document.write(result); +} +else{ +alert("Enter valid number"); + +} +} \ No newline at end of file diff --git a/JS/listOfPairs.js b/JS/listOfPairs.js new file mode 100644 index 0000000..48f2fc1 --- /dev/null +++ b/JS/listOfPairs.js @@ -0,0 +1,22 @@ +function listOfPairs(){ +var sum = document.getElementById("sum").value; +var list = [1, 4, 3, 5, 4, 6, 7, 8, 3]; +if(sum) +{ +document.write("Pairs whoose sum equal to 8 in the given List is :
"); +for(i=0;i<=list.length-1;i++) +{ + for(j=i+1;j<=list.length-1;j++){ + if(list[i]+list[j]==sum) + { + document.write("\"" +list[i]+","+list[j]+ "\""+ "
") + } + } + +} +} +else{ +alert("Enter valid number"); + +} +} \ No newline at end of file diff --git a/JS/multiples.js b/JS/multiples.js new file mode 100644 index 0000000..66757ca --- /dev/null +++ b/JS/multiples.js @@ -0,0 +1,37 @@ +function multiples(){ +var result=0; +var num= document.getElementById("sum").value; +if(num) +{ + +for(i=1;i<=num;i++) +{ +if(i%3==0 && i%5==0) +{ +document.write('FizzBuzz,'); + +} +else if(i%3==0) +{ +document.write('Fizz,'); +} +else if(i%5==0) +{ +document.write('Buzz,'); +} +else{ +if(i==num) +{ +document.write(i); +} +else{ +document.write(i+","); +} +} +} +} +else{ +alert("Enter valid number"); + +} +} \ No newline at end of file diff --git a/JS/palindromeTest.js b/JS/palindromeTest.js new file mode 100644 index 0000000..c508093 --- /dev/null +++ b/JS/palindromeTest.js @@ -0,0 +1,59 @@ +function palindromeTest(){ +var inputString = document.getElementById("str").value; +var res=""; +if(inputString) +{ +res = isPalindrome(inputString); +document.write("
" +res +""); +} +else +{ +alert("Enter valid String"); +} +//res = (Object.values(list)); +//document.write("Values of the list is : "+res +"
"); +} + + +function isPalindrome(param){ +var Palindrome=false; +var result = param.split('').reverse().join(''); +//document.write("Result String after reverse is :" +result); +if(param==result) +{ +Palindrome=true; +return Palindrome; +//document.write("
" +Palindrome +""); +} +else { +return Palindrome; +//document.write("
" +Palindrome +""); + +} +} + + +/* Function to test the palindrome strings in an array */ + +function palindromeList() +{ + var list = ["malayalam", "tree", "boat", "civic", "melt", "level"]; + var res=[]; + var listString=""; + var result = true; + for(i=0;i<=list.length-1;i++) + { + listString = list[i]; + alert(listString); + result = isPalindrome(listString); + if(result) + { + //alert("in loop"); + res.push(listString); + } + + } + + document.write("Result Array is : "+res); + +} \ No newline at end of file diff --git a/JS/repeatedNumbers.js b/JS/repeatedNumbers.js new file mode 100644 index 0000000..da41837 --- /dev/null +++ b/JS/repeatedNumbers.js @@ -0,0 +1,39 @@ +function repeatedNumbers(){ +var list = [1, 2, 3, 5, 8, 4, 7, 9, 1, 4, 12, 5, 6, 5, 2, 1, 0, 8, 1]; +var res =[]; +var result=0; +for(i=0;i<=list.length-1;i++) +{ + + for(j=i+1;j<=list.length-1;j++){ + if(list[i]==list[j]) + { + res.push(list[i]); + } + } + } + document.write( "Actual List Is:"+list +"
"); + //res.push('10'); + // document.write(res); + result = removeDuplicates(res); + + document.write("Unique numbers in the given List is :"+result); + +} + +function removeDuplicates(num) { + var x, + len=num.length, + out=[], + obj={}; + + for (x=0; x obj[num[x]] =" +obj[num[x]]); + } + for (x in obj) { + out.push(x); + } + return out; +} \ No newline at end of file diff --git a/JS/sum.js b/JS/sum.js new file mode 100644 index 0000000..f449382 --- /dev/null +++ b/JS/sum.js @@ -0,0 +1,15 @@ +function sum(){ +var result=0; +var num= document.getElementById("sum").value; +if(num) +{ +for(i=1;i<=num;i++){ + result=result+i; +} +document.write(result); +} +else{ +alert("Enter valid number"); + +} +} \ No newline at end of file diff --git a/JS/sumOfMultiples.js b/JS/sumOfMultiples.js new file mode 100644 index 0000000..73ea753 --- /dev/null +++ b/JS/sumOfMultiples.js @@ -0,0 +1,22 @@ +function sumOfMultiples(){ +var result=0; +var num= document.getElementById("sum").value; +if(num) +{ +document.write("Multiples of 3 or 5 below "+ num +" is :
"); +for(i=1;i Sum of all the multiples of 3 below " + num+ " is : " +result); +} +else{ +alert("Enter valid number"); + +} +} \ No newline at end of file diff --git a/JS/totalSumPaid.js b/JS/totalSumPaid.js new file mode 100644 index 0000000..9ef87a9 --- /dev/null +++ b/JS/totalSumPaid.js @@ -0,0 +1,15 @@ +function totalSumPaid(){ +var list = {"Rick": 85, "Amit": 42, "George": 53, "Tanya": 60, "Linda": 35} +//var res =[]; +var result=0; +//res = (Object.values(list)); +//document.write("Values of the list is : "+res +"
"); +for (let key of Object.keys(list)) { + + result=result+list[key]; + +} + +document.write("Amount paid altogether is: " +result); +} +