Breaking

Post Top Ad

Your Ad Spot

Activity # 14

JavaScript Basic Programming Activity

 

JavaScript Basic Programming Activity


Write a javascript program to print the following characters in a reverse way

 

 


<!DOCTYPE html>

<html>

<head>

<title>Activity 1</title>

</head>

<body>

<script type="text/javascript">

var c1 = 'X';

var c2 = 'M';

var c3 = 'L';

document.write("The reverse of "+c1+c2+c3+" is "+c3+c2+c1);

</script>

</body>

</html>

 

 

Write a javascript program to convert specified days into years, weeks and days.

 

 

 

 

<!DOCTYPE html>

<html>

<head>

<title>Activity 2</title>

</head>

<body>

<script type="text/javascript">

var days_in_year = 365;

var days_in_week = 7;

var total_days = 1329;

var years = parseInt(total_days/days_in_year);

var weeks = parseInt((total_days-(days_in_year*years))/days_in_week);

var days = parseInt(total_days-(days_in_year*years)-(weeks*days_in_week));


document.write("Years: "+years+"<br>");

document.write("Weeks: "+weeks+"<br>");

document.write("days: "+days+"<br>");

</script>

</body>

</html>

 

 

Write a javascript program to print a block F using hash (#), where the F has a height of six characters and width of five and four characters. And also to print a big 'C'.

 

  

 

 

<!DOCTYPE html>

<html>

<head>

<title>Activity 3</title>

</head>

<body>

<script type="text/javascript">

document.write("###### <br>");

document.write("# <br>");

document.write("# <br>");

document.write("###### <br>");

document.write("# <br>");

document.write("# <br>");

document.write("# <br>");

document.write("&nbsp;&nbsp;&nbsp;&nbsp; ###### <br>");

document.write("&nbsp;## &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ##<br>");

document.write("# <br>");

document.write("# <br>");

document.write("# <br>");

document.write("# <br>");

document.write("# <br>");

document.write("&nbsp;## &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ##<br>");

document.write("&nbsp;&nbsp;&nbsp;&nbsp; ###### <br>");

</script>

</body>

</html>

 

 

Write a JavaScript program to compute the perimeter and area of a rectangle with a height of 7 inches. and width of 5 inches.

 

  

 

 

<!DOCTYPE html>

<html>

<head>

<title>Activity 4</title>

</head>

<body>

<script type="text/javascript">

var height = 7;

var width = 5;

var perimeter = 2*(height+width);

var area = height*width;


document.write("Perimeter of the rectangle = "+perimeter+" inches <br>")

document.write("Area of the rectangle = "+area+" square inches")

</script>

</body>

</html>

 

 

 

  


No comments:

Post a Comment

  How to Submit the Practical Exam on Portal EdTechWorx  

Post Top Ad

Your Ad Spot

Pages