Monday, 17 December 2012
Sunday, 2 December 2012
HTML Program
Try the following program in your computer.
<html><head>
<title>My Page</title>
</head>
<body bgcolor=olive>
<font size=7 color=yellow>
<marquee bgcolor=red scrolldelay=400 behavior=scroll> Bishop Cotton Boys' School</marquee>
<marquee scrolldelay=40 direction=left behavior=alternate>Bangalore</marquee>
<marquee direction=up behavior=slide>Computer Science</marquee> </font?
<p>
<center><font color=white size=6 face=Vivaldi> This is the font tag </font></center>
</body>
</html>
Output :
Loops
Loops
There will be a situation where we want to repeat particular statements again and again. For this we have to write those statements again, instead we use the loops to do the same.
To print your name 10 times without using a loop goes like this:
class example
{
public static void main( )
System.out.println(“ BCBS”);
System.out.println(“ BCBS”);
System.out.println(“ BCBS”); 10 times it should be repeated.
System.out.println(“ BCBS”);
System.out.println(“ BCBS”);
System.out.println(“ BCBS”); 10 times it should be repeated.
System.out.println(“ BCBS”);
………………………
……………………….
…………………………
……………………….
…………………………
}
}
Using loops we simplify the program.
Types of Loops :
1. for loop
2. while loop
3. do while loop
for loop
for(intial value ; condition ; update)
note there is no semicolon after for statement.
The above program can be written like this.
class example
{
public static void main( )
{
int i;
System.out.println(“ BCBS”);
}
}
The initial value is 1, BCBS will be printed since the condition is true, i.e i is less than 10. Then it gets incremented to 2, again condition is true so BCBS will be printed again. It goes on till I is equal to 10. Once it is updated the value becomes 11, which does not satisfy the condition. so the loop ends here, control goes to the next line.
}
}
The initial value is 1, BCBS will be printed since the condition is true, i.e i is less than 10. Then it gets incremented to 2, again condition is true so BCBS will be printed again. It goes on till I is equal to 10. Once it is updated the value becomes 11, which does not satisfy the condition. so the loop ends here, control goes to the next line.
while loop
This the entry controlled loop, because the loop will be executed only if the condition is true.
initial value;
while(condition)
{
update;
}
Note there is no semicolon after while statement.
class example
{
public static void main( )
{
{
System.out.println(“ BCBS”);
i++; i is incremented by 1.
}
}
}
}
}
after i++ , the control will go back to while statement to check the condition.
do while loop
This loop is called exit controlled loop. Because the statements will be executed once ,even if the condition is false .In the end of the loop, it checks the condition.
initial value;
do
{
update;
update;
1.
class sum
{
public static void main( int x,int n) x and n values should be given
{
public static void main( int x,int n) x and n values should be given
int i, s=0; initial value should be given.
for(i=1;i<=n;i++)
s=s+(x/i);
System.out.print(“Sum=”+s);
}
}
Note : if the question is + then
}
}
Note : if the question is
s=s+(Math.pow(x,i)/i);
2. Separate the digits in a number.
(e.g) 139,
1, 3,9 should be printed separately.
while(n>0)
{
System.out.println(d);
n=n / 10; Gives the quotient ,that is 13
}
since n is above zero it keeps repeating the statements, finally when n is less than zero ,it skips the loop.
Using the above logic the sum of the digits, reverse the number programs can be done.
3. Fibonacci series :
0, 1, 1, 2, 3, 5, 8, 13 …………………….
Add the previous two numbers to get the third number.
a=0;
b=1;
System.out.println(a );
System.out.println(a );
from 3,
while(ctr<=n)
{
c=a+b;
c=a+b;
System.out.println(c);
b=c; swap the values.
ctr++;
}
a
|
b
|
c=a+b
|
1
| ||
2
| ||
1
|
2
|
3
|
Saturday, 1 December 2012
KG Sports Day
The 26th annual Kindergarten Sports Day was held on 30th November '2012.
Smart NCC cadets .
Chief guest Rosa Kutty with our Principal
Wednesday, 28 November 2012
HTML Formatting Tags
HTML
HTML (Hyper Text MarkUp Language) is used to create web pages. The codes are called tags. The tags are given within < and >.
There are two types of tags ,
i. Container Tag : It has both opening and closing tags.
e.g : <html> </html>
ii. Empty Tag : It has only a opening tag.
e.g : <br>
e.g : <br>
The basic structure of a HTML document is
<html>
<head>
<title>
</title>
</head>
<body>
………
……..
</body>
</html>
Whatever is typed between <title> and </title> will be displayed on the title bar not in the web page.
<html>
</head>
<body>
Your text goes here.
Your text goes here.
</body>
</html>
<head><title> My Page BCBS</title>
</head>
<body>
Bishop Cotton Boys' School
</body>
</html>
The data entered between <body> and </body> only will be displayed in the web page.
I. Formatting Tags :
1. Bold : <b> …</b>
2. Italics : <I> …. </I>
3. Underline : <U> ….</U>
4. Center Tag: The spelling is important. It positions the text in the center of the screen. <center>....</center>
II. Marquee Tag : It helps the text or image move from one direction to the other.
i. Background color:
<marquee bgcolor=olive> ….. </marquee>
ii. Behavior : No u in the spelling.
a. Scroll : It is a default attribute.It moves the text from right to left.
b. Slide : It moves to the opposite direction and stops.
c. Alternate : It moves to the opposite direction , bounces back to the original direction and continues.
<marquee behavior=alternate>…..</marquee>
iii. Speed :
<marquee scrolldelay=number>…..</marquee>
It determines the speed of the marquee. If the number is small, the marquee will move faster, and it moves slower if the number is big.
iv. Direction :
<marquee direction= right or left or up or down>….</marquee>
v. Loop : It gives the number of times the text will move.
<marquee loop=number> ….. </marquee>
Sunday, 25 November 2012
HTML - Worksheet
HTML – Worksheet I
Identify the formatting tags applied in the passage.
25th November ‘2012
Top 3 highly paid
1. Oprah Winfrey :world’s highest paid.
2. Michael Bay : Scored 2nd place.
3. Steven Spielberg : his Dreamworks forayed into TV.
HTML - Worksheet II
Find the error(s) if any in the following program:
<html>
<head>
<title> My Page </head>
</title>
</body>
A postcard signed by the first man on the moon, Neil Armstrong sold for $2,384 </br>
more than three times its pre sale estimate.
<body>
</html>
HTML -Worksheet III
Write programs in HTML to display the following designs:
1.
@
@ @
@
2.
* * * * *
* *
* * * * *
* *
* * * * *
4.Predict the output :
<html>
<head>
<title> Format</title></head>
<body>
_ _ _ _ _ _ __ _<br>
\_/ \_/ \_/ \_/ <br>
</body>
</html>
Subscribe to:
Posts (Atom)