html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://code.jquery.com/jquery-3.1.1.js"></script>
<title>[ CHALLENGE : ] Reverse Floyd's Triangle</title>
<link href="https://fonts.googleapis.com/css?family=Dhurjati|Exo+2|Josefin+Sans|Oswald|Pacifico|Ubuntu+Condensed" rel="stylesheet">
</head>
<body>
<!--
[ CHALLENGE : ] Reverse Floyd's Triangle
Write a program that prints
the reverse Floyd's triangle.
The program should ask the
user how many rows the triangle
consists of.
Floyd's triangle consisting
of 5 rows looks like this :
15 14 13 12 11
10 9 8 7
6 5 4
3 2
1
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
body {
margin:0;
padding:0;
background: #000;
font-family: 'Josefin Sans', sans-serif;
/*
font-family: 'Oswald', sans-serif;
font-family: 'Josefin Sans', sans-serif;
font-family: 'Exo 2', sans-serif;
font-family: 'Ubuntu Condensed', sans-serif;
font-family: 'Pacifico', cursive;
*/
}
a{
color: violet;
}
h2{
background: rgba(0,0,0,0.3);
}
.reverse{
background:url("https://nasaviz.gsfc.nasa.gov/vis/a010000/a012000/a012086/c-1024.jpg");
color: white;
height:90vh;
width:100%;
}
.output{
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$(function(){
loadrev();
$('.revFloyd').keyup(function(){
$(".output").html("");
loadrev();
});
/* $(".revFloyd").keydown(function() {
if (event.keyCode == 13) {
$(".output").html("");
loadrev();
}
});*/
$(".revFloyd").focus(function() {
$(".revFloyd").val("");
});
});
function loadrev(){
num = parseInt($('.revFloyd').val());
x = (num*(num+1))/2;
//$('.output').html("num="+x+"<br/>");
for(i=num ; i>=0;i--){
for(j=i;j>0; j--){
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run