Sunday, 16 February 2020

WT-6


Q1. Write java script program to accept a number from user and check whether it is prime number or not 

<html>
<head>
<script>
function Prime()
{
var i,flag=0,number;
number = Number(document.getElementById("N").value);
for(i=2; i <= number/2; i++)
{
if(number%i == 0)
{
flag = 1;
break;
}
}
if(flag == 0)
{
window.alert(number+"-The inputed number is Prime");
}
else
{
window.alert(number+"-The inputted number is not Prime");
}
}
</script>
</head>
<body>
<br>
<h1>Whether a number is Prime or not</h1>
Enter The Number :<input type="text" name="n" id = "N"/>
<br>
<center><button onClick="Prime()">CHECK</button>
</body>
</html>




Q2. Write a HTML code to display calendar of current month in tabular format. Use proper color for week days and holidays. Display month name, year and images as advertisement at the beginning of the calendar.

<html>
<head>

<style>
body
{
background-image: url("Blue Water Background.jpg");
}

</style>
</head>
<body>

<b><font color="red">March 2020</font></b>
  
<table border=1>

<tr>
<td><font color="red">Sun</font></td>
<td>Mon</td>
<td>Tues</td>
<td>Wed</td>
<td>Thurs</td>
<td>Fri</td>
<td>Sat</td>
</tr>

<tr>
<td><font color="red">1</font></td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
</tr>

 <tr>
<td><font color="red">8</font></td>
<td>9</td>
<td>10</td>
<td>11</td>
<td>12</td>
<td>13</td>
<td>14</td>
</tr>
   
</table>

</body>

</html>