HTML code for 3 different triangles and square shape
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Assignment of Triangles</title>
<script type="text/javascript">
function triangle_1st(){
for(y=1;y<=10;y++){
for(x=1;x<=y;x++){
// Author ~~~~ me.atiq ~~~~
document.write("*");
}
document.write("<br />");
}
}
function triangle_2nd(){
for(y=10;y>=1;y--){
for(x=1;x<=y;x++){
// Author ~~~~ me.atiq ~~~~
document.write("*");
}
document.write("<br />");
}
}
function triangle_3rd(){
for(y=10;y>=1;y--){
for(x=10;x>=1;x--){
// Author ~~~~ me.atiq ~~~~
if(x>y){
document.write(" ");
continue;
}
document.write("*");
}
document.write("<br />");
}
}
function triangle_4th(){
for(y=1;y<=10;y++){
for(x=1;x<=10;x++){
// Author ~~~~ me.atiq ~~~~
if(10-x < y){
document.write("*");
continue;
}
document.write(" ");
}
document.write("<br />");
}
}
function square(){
for(y=1;y<=10;y++){
for(x=1;x<=10;x++){
// Author ~~~~ me.atiq ~~~~
document.write("*");
}
document.write("<br />");
}
}
</script>
</head>
<body>
<input type="button" value="Print Triangle 1st" onclick="triangle_1st();" />
<br/>
<input type="button" value="Print Triangle 2nd" onclick="triangle_2nd();" />
<br/>
<input type="button" value="Print Triangle 3rd" onclick="triangle_3rd();" />
<br/>
<input type="button" value="Print Triangle 4th" onclick="triangle_4th();" />
<br/>
<input type="button" value="Print Square" onclick="square();" />
</body>
</html>
By: Atiq
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Assignment of Triangles</title>
<script type="text/javascript">
function triangle_1st(){
for(y=1;y<=10;y++){
for(x=1;x<=y;x++){
// Author ~~~~ me.atiq ~~~~
document.write("*");
}
document.write("<br />");
}
}
function triangle_2nd(){
for(y=10;y>=1;y--){
for(x=1;x<=y;x++){
// Author ~~~~ me.atiq ~~~~
document.write("*");
}
document.write("<br />");
}
}
function triangle_3rd(){
for(y=10;y>=1;y--){
for(x=10;x>=1;x--){
// Author ~~~~ me.atiq ~~~~
if(x>y){
document.write(" ");
continue;
}
document.write("*");
}
document.write("<br />");
}
}
function triangle_4th(){
for(y=1;y<=10;y++){
for(x=1;x<=10;x++){
// Author ~~~~ me.atiq ~~~~
if(10-x < y){
document.write("*");
continue;
}
document.write(" ");
}
document.write("<br />");
}
}
function square(){
for(y=1;y<=10;y++){
for(x=1;x<=10;x++){
// Author ~~~~ me.atiq ~~~~
document.write("*");
}
document.write("<br />");
}
}
</script>
</head>
<body>
<input type="button" value="Print Triangle 1st" onclick="triangle_1st();" />
<br/>
<input type="button" value="Print Triangle 2nd" onclick="triangle_2nd();" />
<br/>
<input type="button" value="Print Triangle 3rd" onclick="triangle_3rd();" />
<br/>
<input type="button" value="Print Triangle 4th" onclick="triangle_4th();" />
<br/>
<input type="button" value="Print Square" onclick="square();" />
</body>
</html>
By: Atiq
ou have to learned to lot of information about c# .net Gain the knowledge and hands-on experience you need to successfully design, build and deploy applications with html coder
ReplyDelete