Hsslive Xii Comp App Com Solved Lab Work Binukumar 2023 24
Hsslive Xii Comp App Com Solved Lab Work Binukumar 2023 24
in ®
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"Find the largest number among three\n\n\n";
cout<<"Enter three numbers :";
cin>>a>>b>>c;
if((a>b) && (a>c))
cout<<"The largest number is :"<<a;
else if(b>c)
cout<<"The largest number is :"<<b;
else
cout<<"The largest number is :"<<c;
return 0;
}
OUTPUT
2. Input the principal amount, type of account (C for current a/c or S for SB a/c) and number of years, and
display the amount of interest. Rate of interest for current a/c is 8.5% and that of SB a/c is 6.5%.
#include<iostream>
using namespace std;
int main()
{
int am,yr;
char ty;
float cint,sint;
cout<<"Enter the principle amount :\n";
cin>>am;
cout<<"Enter the type of account(c for current and s for savings)\n";
cin>>ty;
cout<<"Enter the number of years (period of deposit) :";
cin>>yr;
cint=(am*8.5/100)*yr;
sint=(am*6.5/100)*yr;
if((ty=='c') || (ty=='C'))
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:1
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
OUTPUT
3. Input a digit and display the same in word. (Zero for 0, One for 1, …., Nine for 9)
#include <iostream>
using namespace std;
int main()
{
long int n,sum=0,r;
cout<<"Enter the Number= ";
cin>>n;
while(n>0)
{
r=n%10;
sum=sum*10+r;
n=n/10;
}
n=sum;
while(n>0)
{
r=n%10;
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:2
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
switch(r)
{
case 1:
cout<<"one ";
break;
case 2:
cout<<"two ";
break;
case 3:
cout<<"three ";
break;
case 4:
cout<<"four ";
break;
case 5:
cout<<"five ";
break;
case 6:
cout<<"six ";
break;
case 7:
cout<<"seven ";
break;
case 8:
cout<<"eight ";
break;
case 9:
cout<<"nine ";
break;
case 0:
cout<<"zero ";
break;
default:
cout<<"not valid";
break;
}
n=n/10;
}
}
OUTPUT
Enter the Number= 485
four eight five
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:3
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
4. Find the sum of the first N natural numbers without using formula.
#include <iostream>
using namespace std;
int main()
{
int n,i,sum=0;
cout<<"sum of First n Natural numbers\n";
cout<<"Input a number\t";
cin>>n;
for(i=1;i<=n;i++)
{
sum=sum+i;
}
cout<<" Answer = "<<sum;
}
OUTPUT
sum of First n Natural numbers
Input a number 10
Answer = 55
int main()
{
int n, num, digit, rev = 0;
n = num;
do
{
digit = num % 10;
rev = (rev * 10) + digit;
num = num / 10;
} while (num != 0);
cout << " The reverse of the number is: " << rev << endl;
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:4
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
if (n == rev)
cout << " The number is a palindrome.";
else
cout << " The number is not a palindrome.";
return 0;
}
OUTPUT
#include <iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter a number :";
cin>>a;
for(int i=1;i<=12;i++)
cout<<i<<" X "<<a<<" = "<<i*a<<"\n";
return 0;
}
OUTPUT
Enter a number :5
1X5=5
2 X 5 = 10
3 X 5 = 15
4 X 5 = 20
5 X 5 = 25
6 X 5 = 30
7 X 5 = 35
8 X 5 = 40
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:5
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
9 X 5 = 45
10 X 5 = 50
11 X 5 = 55
12 X 5 = 60
7. Create an array to store the heights of 10 students and find the largest value.
#include <iostream>
using namespace std;
int main()
{
int i;
int arr[10];
cout <<"Enter the heights of 10 students ";
for(i=0;i<10;i++)
{
cin>>arr[i];
for(i=1;i<10;++i)
{
if(arr[0]<arr[i])
arr[0]=arr[i];
}
cout<<endl<<"Largest student with height = "<<arr[0];
return 0;
}
OUTPUT
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
char ar[15];
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:6
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
int c=0;
cout<<"Enter a string :";
cin>>ar;
for(int i=0;ar[i]!='\0';i++)
{
c++;
}
cout<<"The length of the given string is :"<<c;
return 0;
}
OUTPUT
#include<iostream>
using namespace std;
void fact(int n)
{
int m=1;
for(int i=1;i<=n;i++)
m=m*i;
cout<<"The factorial of "<<n<<" is "<<m;
}
int main()
{
int num;
cout<<"Enter the number :";
cin>>num;
fact(num);
return 0;
}
OUTPUT
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:7
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
10. Input two numbers and swap them with the help of a user defined function.
#include<iostream>
using namespace std;
OUTPUT
11. Design a simple and attractive web page for Kerala Tourism. It should contain features like background
colour/image, headings, text formatting and font tags, images, etc .
<html>
<body bgcolor="cyan">
<center>
<img src="tourism.jpg" height="200" width="250">
<font color="red" size=10>
<h1>Kearala Tourism web page</h1>
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:8
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
</font></center>
<p align="center">
Lush Hill stations<br>
Wild life sancturies<br>
backwater resorts<br>
</p>
<h2><u><i>Tourism Locations</i></u></h2>
<img src="thekkady.jpg" height="150" width="200">
<img src="Munnar.jpg" height="150" width="200">
<img src="Wayanad.jpg" height="150" width="200"><br>
For more inforation contact us
</body>
</html>
OUTPUT
12. Design a simple webpage about your school. Create another webpage named address.htm containing
the school address. Give links from school page to address.htm and reverse.
School.html
<html>
<body bgcolor="cyan">
<center>
<h1>NSS HSS MUNDATHIKODE</h1>
<font color="red" size="6">
My school is located in Mundathicode, Thrissur
<h2>You can find the address by using the following link</h2>
</font>
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:9
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
<br>
<a href="address.html">school address</a>
</center>
</body>
</html>
address.html
<html>
<body bgcolor="yellow">
<center>
<h1>
NSS HSS Mundathicode<br>
Higher Secondary School<br>
Mundathicode wesp PO<br>
Thrissur<br>
Ph 4885286650
<a href="school.html">Go Home</a>
</h1>
</center>
</body>
</html>
OUTPUT
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:10
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
<html>
<body bgcolor="yellow">
<h2>Permanent members in UN Security Council </h2>
<ul>
<li>Russia</li>
<li>China</li>
<li>USA</li>
<li>UK</li>
<li>France</li>
</ul>
</body>
</html>
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:11
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
OUTPUT
<html>
<body bgcolor="yellow">
<h2>Wild life Sanctuaries in Kerala </h2>
<ol>
<li>Eravikulam</li>
<li>Periyar</li>
<li>Chinnar</li>
<li>Wayanad</li>
</ol>
</body>
</html>
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:12
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
OUTPUT
<html>
<body bgcolor="yellow">
<b>SPEED LIMITS IN KERALA</b><br>
<table border="2">
<tr><th>Vehicles</th><th>Near School <br>(In Km/hour)</th><th>Within Corporation/<br> Municipality<br> (In
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:13
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
OUTPUT
<html>
<body bgcolor="yellow">
<form name="f1" action="school.html">
<h4>Client Login</h4>
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:14
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
</form>
</body>
</html>
OUPUT
a. Update the column Total with the sum of Mark1, Mark2 and Mark3.
c. Display the name and total marks of students who are failed (Total < 90).
OUTPUT
mysql> create database school;
Query OK, 1 row affected (0.06 sec)
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:15
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:16
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
18. Create a table named "Employee" with the following fields and insert at least 5 records except the column named
gross_pay and DA.
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:17
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:18
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
+----------+----------+--------------+--------------+----------+----------+-----------+
+----------+----------+--------------+--------------+----------+----------+-----------+
+----------+----------+--------------+--------------+----------+----------+-----------+
+----------+----------+--------------+------------+----------+----------+-----------+
+----------+----------+--------------+------------+----------+----------+-----------+
+----------+----------+--------------+------------+----------+----------+-----------+
+----------+----------+--------------+--------------+----------+----------+-----------+
+----------+----------+--------------+--------------+----------+----------+-----------+
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:19
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
+----------+----------+--------------+--------------+----------+----------+-----------+
+----------+----------+-------------+--------------+---------+---------+-----------+
+----------+----------+-------------+--------------+---------+---------+-----------+
+----------+----------+-------------+--------------+---------+---------+-----------+
19. Create a table Stock, which stores daily sales of items in a shop, with the following fields and insert at least 5 records into the
table.
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:20
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:21
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
20. Create a table Bank with the following fields and insert at least 5 records into the table.
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:22
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
+--------+----------+-------------+----------+----------+
+--------+----------+-------------+----------+----------+
+--------+----------+-------------+----------+----------+
+--------+----------+-------------+----------+----------+
+--------+----------+-------------+----------+----------+
+--------+----------+-------------+----------+----------+
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:23
Join Now: https://join.hsslive.in Downloaded from https://www.hsslive.in ®
+--------+----------+--------------------+----------+----------+
+--------+----------+--------------------+----------+----------+
+--------+----------+--------------------+----------+----------+
+----------+--------+
| acc_name | acc_no |
+----------+--------+
| Binu | 121 |
| Sarath | 124 |
| Hari | 125 |
+----------+--------+
+--------+----------+-------------+----------+---------+
+--------+----------+-------------+----------+---------+
+--------+----------+-------------+----------+---------+
Prepared by Binu Kumar V V, HSSTComputer Science, NSS HSS Mundathicode for Hsslive.in Page No:24