Skip to content

Commit

Permalink
added week 4
Browse files Browse the repository at this point in the history
  • Loading branch information
maa17019 committed Feb 15, 2021
1 parent a9995c6 commit 7bf55fe
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions week-4/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Week 4 Exercises</title>

<style>
body{
margin: 3%;
}
h1{
color: #2E39DF;
margin-right: 1%;
}
span {
color: #8288d6;
}
</style>
</head>
<body>
<h1><code>Week 4 Assignment</code> <span>&#10230;</span></h1>


<script>
//Looping a triangle exercise
console.log("EXERCISE 1: Looping A Triangle");

for (let hash = "#"; hash.length <= 7 ; hash += "#" ) {
console.log(hash);
}

//FizBuzz Exercise
console.log("EXERCISE 2: FizzBuzz");

for(let num = 1; num <= 100; num++) {
let output = "";
if( num % 3 == 0)
output += "Fizz";
if(num % 5 == 0)
output += "Buzz";
console.log(output || num);
}

/*function nano(mano){
if (mano < 5) {
console.log("less than five");
} else {
console.log("more than 5");
}
}*/

console.log("EXERCISE 3: Chessboard");

let size = 8;
let chess = "";

for (let y = 0; y < size; y++) {
for (let x = 0; x < size; x++) {
if ((x + y) % 2 == 0) {
chess += " ";
} else {
chess += "#";
}
}
chess += "\n";
}

console.log(chess);



</script>
</body>
</html>

0 comments on commit 7bf55fe

Please sign in to comment.