83% found this document useful (98 votes)
79K views48 pages

Computer Science Manual For 2nd PUC, Karnataka Board

This document contains computer science programs and code snippets for various array and class programs. It includes 15 programs covering topics like frequency counting in arrays, insertion and deletion from arrays, sorting arrays, binary search, simple interest calculation using classes, roots of quadratic equation, function overloading for area calculation, inline functions, series summation using constructors, single level inheritance, pointers to objects, stack operations like push and pop, and queue operations like enqueue and dequeue. Each program is accompanied by sample input/output. The document appears to be teaching material for a second year pre-university (PU) computer science class.

Uploaded by

SalmaMubarakJ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
83% found this document useful (98 votes)
79K views48 pages

Computer Science Manual For 2nd PUC, Karnataka Board

This document contains computer science programs and code snippets for various array and class programs. It includes 15 programs covering topics like frequency counting in arrays, insertion and deletion from arrays, sorting arrays, binary search, simple interest calculation using classes, roots of quadratic equation, function overloading for area calculation, inline functions, series summation using constructors, single level inheritance, pointers to objects, stack operations like push and pop, and queue operations like enqueue and dequeue. Each program is accompanied by sample input/output. The document appears to be teaching material for a second year pre-university (PU) computer science class.

Uploaded by

SalmaMubarakJ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

OASIS PU COLLEGE

SECOND PUC

COMPUTER SCIENCE

Salma Begum J
Lecturer,
OASIS PU COLLEGE

1. Write a program to find the frequency of presence of an element in an array.


#include<iostream.h>
#include<conio.h>
void main()
{
int a[100],ele,n,i,freq;
clrscr();
cout<<"Enter the size of array"<<endl;
cin>>n;
cout<<"Enter the elements of array"<<endl;
for(i=0;i<n;i++)
{
cin>>a[i];
}
cout<<"Enter the element to be counted"<<endl;
cin>>ele;
freq=0;
for(i=0;i<n;i++)
{
if(a[i]==ele)
{
freq=freq+1;
}
}
cout<<"Frequency of "<<ele<<" is "<<freq;
getch();
}

OUTPUT

2. Write a program to insert an element into an array at a given position.


#include<iostream.h>
#include<conio.h>
void main()
{
int a[100],ele,n,i,pos;
clrscr();
cout<<"Enter the size of array"<<endl;
cin>>n;
cout<<"Enter the elements of array"<<endl;
for(i=0;i<n;i++)
{
cin>>a[i];
}
cout<<"Enter the position to insert element"<<endl;
cin>>pos;
if(pos<n)
{
cout<<"Enter the element to be inserted"<<endl;
cin>>ele;
cout<<"Array before insertion:"<<endl;
for(i=0;i<n;i++)
{
cout<<a[i]<<"
";
}
cout<<endl;
for(i=n;i>pos-1;i--)
{
a[i]=a[i-1];
}
a[pos-1]=ele;
cout<<"Array after insertion:"<<endl;
for(i=0;i<=n;i++)
{
cout<<a[i]<<"
";
}
}
else
cout<<"Invalid position"<<endl;
getch();
}

OUTPUT

3. Write a program to delete an element from an array from a given position


#include<iostream.h>
#include<conio.h>
void main()
{
int a[100],n,i,pos;
clrscr();
cout<<"Enter the size of array"<<endl;
cin>>n;
cout<<"Enter the elements of array"<<endl;
for(i=0;i<n;i++)
{
cin>>a[i];
}
cout<<"Enter the position to delete element"<<endl;
cin>>pos;
if(pos<n)
{
cout<<"Array before deletion:"<<endl;
for(i=0;i<n;i++)
{
cout<<a[i]<<"
";
}
cout<<endl;
for(i=pos-1;i<n-1;i++)
{
a[i]=a[i+1];
}
cout<<"Array after deletion:"<<endl;
for(i=0;i<n-1;i++)
{
cout<<a[i]<<"
";
}
}
else
cout<<"Invalid position"<<endl;
getch();
}

OUTPUT

4 . Write a program to sort the elements of an array in ascending order using insertion sort.
#include<iostream.h>
#include<conio.h>
void main()
{
int a[100],n,i,j,temp;
clrscr();
cout<<"Enter the size of array"<<endl;
cin>>n;
cout<<"Enter the elements of array"<<endl;
for(i=0;i<n;i++)
{
cin>>a[i];
}
cout<<"Unsorted array:"<<endl;
for(i=0;i<n;i++)
{
cout<<a[i]<<"
";
}
cout<<endl;
for(i=1;i<n;i++)
{
j=i;
while(j>=1)
{
if(a[j]<a[j-1])
{
temp=a[j];
a[j]=a[j-1];
a[j-1]=temp;
}
j=j-1;
}
}
cout<<"Sorted array:"<<endl;
for(i=0;i<n;i++)
{
cout<<a[i]<<"
";
}
getch();
}

OUTPUT

5. Write a program to search for a given element in an array using Binary search method.
#include<iostream.h>
#include<conio.h>
void main()
{
int a[100],ele,n,i,mid,low,high,loc;
clrscr();
cout<<"Enter the size of array"<<endl;
cin>>n;
cout<<"Enter the elements of array"<<endl;
for(i=0;i<n;i++)
{
cin>>a[i];
}
cout<<"Enter the element to be searched"<<endl;
cin>>ele;
high=n-1;
low=0;
loc=-1;
while(low<=high)
{
mid=(low+high)/2;
if(a[mid]==ele)
{
loc=mid+1;
break;
}
if(ele>a[mid])
low=mid+1;
else
high=mid-1;
}
if(loc==-1)
cout<<"Element not found"<<endl;
else
cout<<"Element "<<ele<<" found at location "<<loc;
getch();
}

OUTPUT

6 . Write a program to create a class with data members principle, time and rate. Create member

functions to accept data values to compute simple interest and to display the result.
#include<iostream.h>
#include<conio.h>
class simple_interest
{
private:
int principle,time,rate;
float si;
public:
void input_data()
{
cout<<"Input Principle amount=";
cin>>principle;
cout<<"Input time in years=";
cin>>time;
cout<<"Input rate of interest=";
cin>>rate;
}
void compute()
{
si=principle*rate*time/100;
}
void display()
{
cout<<"Simple interest="<<si;
}
};
void main()
{
simple_interest s;
clrscr();
s.input_data();
s.compute();
s.display();
getch();
}

OUTPUT

7. Write a program to create a class with data members a, b, c and member functions to input

data, compute the discriminant based on the following conditions and print the roots.
If determinant=0, print the roots that are equal
If the discriminant is>0, print the real roots
If the discriminant<0, print that the roots are imaginary
#include<iostream.h>
#include<conio.h>
#include<math.h>
class roots
{
private:
int a,b,c;
float det,x,x1,x2;
public:
void input_data()
{
cout<<"Input the values for co-efficients (a,b and c)";
cout<<"a=";
cin>>a;
cout<<"b=";
cin>>b;
cout<<"c=";
cin>>c;
}
void compute()
{
det=b*b-4*a*c;
}
void display()
{
if(det==0)
{
x=-b/(2*a);
cout<<"Roots are equal"<<endl;
cout<<"Root is "<<x;
}
if(det<0)
{
cout<<"Roots are imaginary"<<endl;
}
if(det>0)
{
x1=(-b+sqrt(det))/(2*a);
x2=(-b-sqrt(det))/(2*a);
cout<<"Roots are real and distinct"<<endl;
cout<<"Roots are "<<x1<<"and"<<x2;
}
}
};
void main()
{
roots r;
clrscr();
r.input_data();
r.compute();
r.display();

getch();
}

OUTPUT

8. Program to find the area of a square/rectangle/triangle using function overloading.


#include<iostream.h>
#include<conio.h>
#include<math.h>
int a,b,c,l;
int area(int a)
{
int area1;
cout<<"Enter the side of square"<<endl;
cin>>a;
area1=a*a;
cout<<"Area of the square is "<<area1;
return 0;
}
int area(int l,int b)
{
int area2;
cout<<"Enter the length and breadth of rectangle"<<endl;
cout<<"length=";
cin>>l;
cout<<"Breadth=";
cin>>b;
area2=l*b;
cout<<"Area of rectangle is "<<area2;
return 0;
}
float area(int a,int b,int c)
{
float s,area3;
cout<<"Enter the sides of triangle"<<endl;
cout<<"a=";
cin>>a;
cout<<"b=";
cin>>b;
cout<<"c=";
cin>>c;
s=(a+b+c)/2;
area3=sqrt(s*(s-a)*(s-b)*(s-c));
cout<<"Area of triangle is "<<area3;
return 0;
}
void main()
{
int option;
clrscr();
cout<<"Enter:"<<endl;
cout<<"1-Area of square"<<endl;
cout<<"2-Area of rectangle"<<endl;
cout<<"3-Area of triangle"<<endl;
cin>>option;
switch(option)
{
case 1:area(a);
break;
case 2:area(l,b);
break;

case 3:area(a,b,c);
break;
default:cout<<"Invalid option";
break;
}
getch();
}

OUTPUT

9 . Program to find the cube of a number using inline functions.


#include<iostream.h>
#include<conio.h>
int c,n;
inline int cube(int a)
{
int c;
c=a*a*a;
cout<<"Cube of "<<n<<" is "<<c;
return 0;
}
void main()
{
clrscr();
cout<<"Enter the number to find cube"<<endl;
cin>>n;
cube(n);
getch();
}

OUTPUT

10. Write a program to find the sum of the series 1+ x + x2 + + xn using constructors.
#include<iostream.h>
#include<conio.h>
#include<math.h>
class series
{
private:
int sum,n,i,x;
public:
series()
{
sum=1;
}
void input_data()
{
cout<<"Enter the value of n"<<endl;
cin>>n;
cout<<"Enter the value of x"<<endl;
cin>>x;
}
void sum_series()
{
for(i=1;i<=n;i++)
{
sum=sum+pow(x,i);
}
}
void display()
{
cout<<"Sum of the series is "<<sum;
}
};
void main()
{
series s;
clrscr();
s.input_data();
s.sum_series();
s.display();
getch();
}

OUTPUT

11. Create a base class containing the data members roll number and name. Also create a member

function to read and display the data using the concept of single level inheritance. Create a
derived class that contains marks of two subjects and total marks as data members.
#include<iostream.h>
#include<conio.h>
class student
{
private:
int roll_no;
char name[50];
public:
void input_data()
{
cout<<"Enter the roll number:";
cin>>roll_no;
cout<<"Enter the name:";
cin>>name;
}
void display_data()
{
cout<<"Roll number:"<<roll_no<<endl;
cout<<"Name of student:"<<name<<endl;
}
};
class marks:public student
{
private:
int m1,m2,total;
public:
void input_marks()
{
cout<<"Enter the marks of two subjects"<<endl;
cout<<"Subject 1:";
cin>>m1;
cout<<"Subject 2:";
cin>>m2;
}
void calculate()
{
total=m1+m2;
}
void display_marks()
{
cout<<"Subject 1="<<m1<<endl;
cout<<"subject 2="<<m2<<endl;
cout<<"Total="<<total;
}
};
void main()
{
marks m;
clrscr();
m.input_data();
m.input_marks();
m.calculate();

m.display_data();
m.display_marks();
getch();
}

OUTPUT

12. Create a class containing the following data members register No., name and fees. Also create a

member function to read and display the data using the concept of pointers to objects.
#include<iostream.h>
#include<conio.h>
class student
{
private:
int roll_no,fees;
char name[50];
public:
void read_data()
{
cout<<"Enter the roll number:";
cin>>roll_no;
cout<<"Enter the name:";
cin>>name;
cout<<"Enter the fees:";
cin>>fees;
}
void display_data()
{
cout<<"Roll number:"<<roll_no<<endl;
cout<<"Name of student:"<<name<<endl;
cout<<"Fees:"<<fees<<endl;
}
};
void main()
{
student *s;
clrscr();
s->read_data();
s->display_data();
getch();
}

OUTPUT

13. Write a program to perform push items into the stack.


#include<iostream.h>
#include<conio.h>
class stack
{
private:
int top,ele,s[20],i;
public:
stack()
{
top=-1;
}
void push()
{
top=top+1;
cout<<"Enter the element to insert"<<endl;
cin>>ele;
s[top]=ele;
}
void display()
{
if(top==-1)
cout<<Stack underflow<<endl;
else
cout<<"Stack elements are"<<endl;
for(i=top;i>=0;i--)
{
cout<<s[i]<<endl;
}
}
};
void main()
{
char choice;
stack s;
clrscr();
do
{
s.push();
cout<<"Do you wish to continue(y/n)"<<endl;
cin>>choice;
}
while(choice=='y');
s.display();
getch();
}

OUTPUT

14 . Write a program to pop elements from the stack.


#include<iostream.h>
#include<conio.h>
class stack
{
private:
int top,ele,s[20],i;
public:
stack()
{
top=-1;
}
void push()
{
top=top+1;
cout<<"Enter the element to insert"<<endl;
cin>>ele;
s[top]=ele;
}
void pop()
{
if(top==-1)
cout<<"Stack underflow"<<endl;
else
cout<<"Element deleted is "<<s[top]<<endl;
top=top-1;
}
void display()
{
if(top==-1)
cout<<Stack underflow<<endl;
else
cout<<"Stack elements are"<<endl;
for(i=top;i>=0;i--)
{
cout<<s[i]<<endl;
}
}
};
void main()
{
char choice;
int option;
stack s;
clrscr();
do
{
cout<<"Enter:"<<endl;
cout<<"1->Push"<<endl;
cout<<"2->Pop"<<endl;
cout<<"3->Display"<<endl;
cin>>option;
switch(option)
{
case 1:s.push();
break;

case 2:s.pop();
break;
case 3:s.display();
break;
default:cout<<"Invalid option"<<endl;
break;
}
cout<<"Do you wish to continue(y/n)"<<endl;
cin>>choice;
}while(choice=='y');
getch();
}

OUTPUT

15 . Write a program to perform enqueue and dequeue.


#include<iostream.h>
#include<conio.h>
#define max 20
class queue
{
private:
int front,rear,ele,q[20],i;
public:
queue()
{
front=0;
rear=-1;
}
void enque()
{
rear=rear+1;
cout<<"Enter the element to insert in queue"<<endl;
cin>>ele;
q[rear]=ele;
}
void deque()
{
if(front>rear)
cout<<"Queue underflow"<<endl;
else
cout<<"Element deleted from queue is "<<q[front]<<endl;
front=front+1;
}
void display()
{
if(front>rear)
cout<<"Queue underflow"<<endl;
else
cout<<"Elements of queue are:"<<endl;
for(i=front;i<=rear;i++)
{
cout<<q[i]<<"
";
}
}
};
void main()
{
char choice;
int option;
queue q;
clrscr();
do
{
cout<<"Enter:"<<endl;
cout<<"1->Enque"<<endl;
cout<<"2->Deque"<<endl;
cout<<"3->Display"<<endl;
cin>>option;
switch(option)
{

case 1:q.enque();
break;
case 2:q.deque();
break;
case 3:q.display();
break;
default:cout<<"Invalid option"<<endl;
break;
}
cout<<"Do you wish to continue(y/n)"<<endl;
cin>>choice;
}while(choice=='y');
getch();
}

OUTPUT

16 . Write a program to create a linked list and appending nodes.


#include<iostream.h>
#include<conio.h>
class linked_list
{
private:
int ele;
struct node
{
int data;
node *link;
}*start,*newnode,*temp;
public:
linked_list()
{
start=NULL;
}

void append()
{
cout<<"Enter element to insert"<<endl;
cin>>ele;
newnode=new node;
newnode->data=ele;
newnode->link=NULL;
if(start==NULL)
{
start=newnode;
cout<<ele<<" is inserted"<<endl;
}
else
{
temp=start;
while(temp->link!=NULL)
temp=temp->link;
temp->link=newnode;
cout<<ele<<" is inserted"<<endl;
}
}
void display()
{
if(start==NULL)
{
cout<<"Linked list is empty"<<endl;
return;
}
cout<<"Linked list contains"<<endl;
temp=start;
while(temp!=NULL)
{
cout<<temp->data<<"->";
temp=temp->link;
}
cout<<"NULL"<<endl;
}
};
void main()
{

char choice;
int option;
linked_list l;
clrscr();
do
{
cout<<"Enter:"<<endl;
cout<<"1->Append"<<endl;
cout<<"2->Display"<<endl;
cin>>option;
switch(option)
{
case 1:l.append();
break;
case 2:l.display();
break;
default:cout<<"Invalid choice"<<endl;
break;
}
cout<<"Do you wish to continue(y/n):";
cin>>choice;
}while(choice=='y');
getch();
}

OUTPUT

Section B SQL
17. Generate the Electricity Bill for one consumer
1. Create a table
sql> create table ebill(RR_number varchar(10),Consumer_name
varchar(30),bill_date date,Units_consumed number(5));

2. Check the structure of table


sql>desc ebill;

3. Add records into the table


sql>insert into ebill values(AA451243,Ali,10-jun-2015,650);

sql>insert into ebill values(AA476347,Zuhair,15-jan-2014,50);

sql>insert into ebill values(AA234358,Yasir,28-feb-2015,78);

sql>insert into ebill values(AA765432,Danish,20-mar-2013,245);

sql>insert into ebill values(AA345265,Saif,12-may-2012,65);

sql>insert into ebill values(BA459012,Zaim,24-feb-2012,400);

sql>insert into ebill values(DY567743,Saad,16-jul-2013,35);

sql>insert into ebill values(BX876509,Hashim,26-feb-2014,900);

sql>insert into ebill values(DY677569,Eesa,20-jun-2014,897);

sql>insert into ebill values(CA209786,Ryaan,19-jan-2012,979);

4. View table
sql>select * from ebill;

5. Add new fields.


sql>alter table ebill add(Due_date date,Bill_amount number(5 ,2));
6. Compute bill date and bill amount (if bill amount>100 then first
100 units at Rs.4.5 per unit and rest at Rs.5.5 per unit)
sql>update ebill set Due_date=bill_date+15;

sql>update ebill set Bill_amount=100+Units_consumed*4.5 where


units<100;

sql> update ebill set Bill_amount=100+100*4.5+(Units_consumed 100)*5.5 where units>100;

7. View table
sql>select * from ebill;

18. Create a student database and compute the result.


1. Create table
sql> create table student(student_id number(5),student_name
varchar(20),Subject1 number(4),Subject2 number(4),Subject3
number(4),subject4 number(4));

2. Check the structure of table


sql>desc student;

3. Add records into table


sql>insert into student values(10201,Ali,98,80,78,90);
sql>insert into student values(10202,Zuhair,88,50,38,70);
sql>insert into student values(10203,Yasir,60,50,58,60);
sql>insert into student values(10204,Danish,88,90,98,99);
sql>insert into student values(10205,Saif,30,40,78,90);
sql>insert into student values(10206,Zaim,89,70,95,40);
sql>insert into student values(10207,Saad,67,72,56,40);
sql>insert into student values(10208,Hashim,23,30,40,50);
sql>insert into student values(10209,Eesa,99,90,98,96);
sql>insert into student values(10210,Ryaan,58,70,78,80);

4. View table
sql>select * from student;

5. Add fields to table.


sql>alter table student(Total number(5),Percentage number(5),Result
varchar(15));

6. Calculate total, percentage and result(if all subjects>=35 and


percentage>=60->First class,if all subjects>=35 and
percentage>=35->Second class, If any subject<35->Fail)
sql>update student set Total=Subject1+Subject2+Subject3+Subject4;
sql>update student set Percentage=Total/4;
sql>update student set Result=First Class where Subject1>=35 and
Subject2>=35 and Subject3>=35 and Subject4>=35 and Percentage>=60;
sql>update student set Result=Second Class where Subject1>=35 and
Subject2>=35 and Subject3>=35 and Subject4>=35 and Percentage>=35;
sql>update student set Result=Fail where Subject1<35 or Subject2<35
or Subject3<35 or Subject4<35;

7. View table
sql>select * from student;

8. Count the number of students who failed


sql>select count(*) from student where result=Fail;

9. Count the number of students who have passed.


Sql>select count(*) from student where Result=First Class or
Result=Second Class;

10.
Count the nmber of students who have scored more than 60
percentage
sql>select count(*) from student where Percentage>60;

11.
List the students who have failed
sql>select * from student where Result=Fail;

12.
List the students who have passed.
sql>select * from student where Result=First Class or
Result=Second Class;

19 Generate the Employee details and compute the salary based on the
department.
1. Create table
sql>create table employee(Emp_id number(5),Emp_name
varchar(30),Department varchar(20),Salary number(10));
2. Enter 10 rows into table.
sql>insert into employee values(786523,Zain,Accounts,30000);
sql>insert into employee values(786521,Zain,Sales,40000);
sql>insert into employee values(786522,Owais,Purchase,35000);
sql>insert into employee values(786523,Saad, Purchase,25000);
sql>insert into employee values(786524,Zuhair,Sales,20000);
sql>insert into employee values(786525,Akhtar,Purchase,36000);
sql>insert into employee values(786526,Ali, Purchase,45000);
sql>insert into employee values(786527,Dyaan,Sales,27000);
sql>insert into employee values(786528,Yasir,Purchase,39000);
sql>insert into employee values(786529,Aamir,Sales,42000);
sql>insert into employee values(786530,Hashim,Sales,36000);
3. Find the names of the employees who work for sales department
sql>select * from employee where Department=Sales;

4. Find the number of employees working for purchase department


sql>select count(*) from employee where Department=Purchase;

5. Find the maximum, minimum and average salary of employees who


work for sales department.
sql>select max(Salary) from employee where Department=Sales;

sql>select min(Salary) from employee where Department=Sales;

sql>select average(Salary) from employee where Department=Sales;

6. View table
sql>select * from employee;

7. Increase the salary of all the employees in purchase department


by 15%.
sql>update employee set Salary=Salary+Salary*0.15 where
Department=Purchase;

8. Add new field Bonus and calculate bonus as 20% of salary.


sql>alter table employee add Bonus number(10);
sql>update employee set Bonus=Salary*0.20;

9. View updated table.


sql>select * from employee;

10.
Delete the rows for the employee who works for purchase
department.
sql>delete from employee where Department=Purchase;
11.
View table.
sql>select * from employee;

20. Create database for the bank transaction.


1. Create table
sql>create table bank(Account number(10),C_name varchar(30),Address
varchar(20),Initial_amount number(10),T_date date,T_amount
number(10),T_type varchar(2));

2. Insert values into the table


sql>insert into bank values(98986745,Ali,Hennur,10000,12-jan2015,5000,D);
sql>insert into bank values(98986746,Dyaan,Hebbal,30000,18-may2015,4000,W);
sql>insert into bank values(98986747,Danish,Rajajinagar, 100000,
09-jul-2005,15000,W);
sql>insert into bank values(98986748,Saif,Malleswaram,60000,01jan-2015,6000,D);
sql>insert into bank values(98986749,Junaid,HSR layout,40000,
12-may-2009,9000,D);
sql>insert into bank values(98986750,Zyaan,Maratahalli,30000,10jun-2015,6500,W);
sql>insert into bank values(98986751,Saad,Kalyan nagar,10 00000,
21-jan-2011,60000,D);
sql>insert into bank values(98986752,Hamid,Kammanahalli, 900000,
22-feb-2010,8000,W);
sql>insert into bank values(98986753,Idrees,Benson town, 90000,
02-mar-2012,10000,W);
sql>insert into bank values(98986754,Aahil,Hennur,400000,10-jan2014,55000,D);

3. Count and display number of transactions grouping based on type


of transaction.
sql>select T_type,count(*) from bank group by T_type;
4. View table
sql>select * from bank;

5. Add field balance and calculate balance


sql>alter table bank add Balance number(10);
sql>update bank set Balance=Initial_amount-T_amount where T_type=W;
sql>update bank set Balance=Initial_amount+T_amount where T_type=D;

6. Delete the details of the customers who belong to Hennur .


sql>delete from bank where Address=Hennur;

7. Trace the information of the customer from kamanahalli


sql>select * from bank where Address=Kamanahalli;

8. View Customer id, customer name,Initial amount,type of


transaction,transaction amount,balance.
sql>select Account number,C_name,Initial_amount,T_amount,T_type,
Balance from bank;

9. Find the sum of amount deposited.


sql>select sum(T_amount) from bank where T_type=D;

10.
Find the sum of amount withdrawn.
sql>select sum(T_amount) from bank T_type=W;

Section C HTML
21. Write a HTML program to create a study time-table.
<html>
<head>
<title>Table</title>
</head>
<body bgcolor="pink">
<center><h1>MY STUDY TIME TABLE</h1></center>
<center>
<table border=5px bgcolor="orange" height=400px width=800px>
<tr>
<th>DAY</th>
<th>Morning study time</th>
<th>College timings</th>
<th>Evening study time</th>
<th>Question paper solving</th>
</tr>
<tr>
<td>MONDAY</th>
<td>5:00 to 6:30</td>
<td>8:30 to 4:00</td>
<td>6:00 to 8:30</td>
<td>9:00 to 10:30</td>
</tr>
<tr>
<td>TUESDAY</th>
<td>5:00 to 6:30</td>
<td>8:30 to 4:00</td>
<td>6:00 to 8:30</td>
<td>9:00 to 10:30</td>
</tr>
<tr>
<td>WEDNESDAY</th>
<td>5:00 to 6:30</td>
<td>8:30 to 4:00</td>
<td>6:00 to 7:30</td>
<td>9:30 to 10:30</td>
</tr>
<tr>
<td>THURSDAY</th>
<td>5:00 to 6:30</td>
<td>8:30 to 4:00</td>
<td>6:00 to 7:30</td>
<td>9:30 to 10:30</td>
</tr>
<tr>
<td>FRIDAY</th>
<td>5:00 to 6:30</td>
<td>8:30 to 4:00</td>

<td>6:00 to 7:30</td>
<td>9:30 to 10:30</td>
</tr>
<tr>
<td>SATURDAY</th>
<td>5:00 to 6:30</td>
<td>8:30 to 1:00</td>
<td>5:00 to 7:30</td>
<td>8:30 to 10:30</td>
</tr>
</table>
</center>
<marquee direction="left"><h1>All the best!!!</h1></marquee>
</body>
</html>

OUTPUT

22. Create an HTML program with table and Form.


<html>
<head>
<title>Table and form</title>
</head>
<body>
<h2 text color=#ff0200>STUDENT'S DATA</h2>
<table width=700px border=5px>
<form>
<tr>
<td>
<label for="s_name">Student's Name</label>
</td>
<td>
<input type="text" name="s_name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td>
<label for="s_id">Student's ID</label>
</td>
<td>
<input type="text" name="s_id" maxlength="50" size="30">
</td>
</tr>
<tr>
<td>
<label for="f_name">father's Name</label>
</td>
<td>
<input type="text" name="f_name" maxlength="50" size="50">
</td>
</tr>
<tr>
<td>
<label for="m_name">Mother's Name</label>
</td>
<td>
<input type="text" name="m_name" maxlength="50" size="50">
</td>
</tr>
<tr>
<td>
<label for="mob">Mobile number</label>
</td>
<td>
<input type="text" name="mob" maxlength="50" size="30">
</td>
</tr>

<tr>
<td>
<label for="mail">Email id</label>
</td>
<td>
<input type="text" name="mail" maxlength="50" size="50">
</td>
</tr>
<tr>
<td>
<input type="Submit" value="Submit form">
</td>
</tr>
</form>
</table>
</body>
</html>

OUTPUT

You might also like