Dhirendra Kumar Yadav
Harshit Kumar Singh
1. PROGRAMMING C-PROGRAMMING
C is a procedural programming
language. It was initially
developed by Dennis Ritchie in
the year 1972. It was mainly
developed as a system
programming language to
write an operating system.
The main features of the C
language include low-level
memory access, a simple set
of keywords, and a clean style,
these features make C
language suitable for system
programming like an operating system or compiler
development. Many later languages have borrowed
syntax/features directly or indirectly from the C
language. Like syntax of Java, PHP, JavaScript, and
many other languages are mainly based on the C
language. C is a procedural programming language.
It was initially developed by Dennis Ritchie in the
year 1972. It was mainly developed as a system
programming language to write an operating
system. The main features of the C language
include low- level memory access, a simple set of
keywords, and a clean style, these features make C
language suitable for system programming's like an
operating system or compiler development. Many
later languages have borrowed syntax/features
directly or indirectly from the C language. Like
syntax of Java, PHP, JavaScript, and many other
languages are mainly based on the C language.
Steps to open TURBO C++:
i. Open your Computer.
ii.Click on windows tab and search for TURBO C++.
iii.Click on START TURBO C++.
iv. PRESS Alt + F and then N to open a new page.
Function Related Programs.
i)
#include<stdio
.h>
#include<conio
.h> void
design(); void
main()
{ clrscr();
design();
getch();
}
void design() {
char x;
printf("Enter a letter:
"); scanf("%c",&x);
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++) {
printf("%c",x);
}
printf("\n");
}}
ii)
#include<stdio.
h>
#include<conio
.h> #define pi
3.1415 float
area(int r); void
main()
{
int r;
clrscr();
printf("Enter the
radius: ");
scanf("%d",&r);
printf("The area of the circle is
%.2f",area(r)); getch();
}
float area(int r)
{
float A = 2 * pi
* r; return A;
}
iii)
#include<stdio.
h>
#include<conio
.h> void sqr(int
n); void main()
{
int n;
clrscr();
printf("Enter a
number: ");
scanf("%d",&n);
sqr(n);
getch();
}
void sqr(int n)
{
int S = n * n;
printf("The square of %d is %d",n, S);
}
iv)
#include<stdio.
h>
#include<conio
.h> void cube();
void main()
{
clrscr();
cube();
getch();
}
void cube()
{
int n,S;
printf("Enter a
number: ");
scanf("%d",&n);
S = n * n * n;
printf("The cube of %d is %d",n, S);
}
v)
include<stdio.h
>
#include<conio
.h> void
series();
void main()
{
clrscr();
series();
getch();
}
void series()
{
int n;
printf("Enter number of terms: ");
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
printf("%d,",i * i);
}
}
vi)
#include<stdio.
h>
//#include<conio.h>
void exponent(int n,
int x); void main()
{
//
clrscr();
int n,x;
printf("Enter number
: "); scanf("%d",&n);
printf("Enter the degree of exponent :
"); scanf("%d",&x);
exponent(n,x);
//getch();
}
void exponent(int n,int x)
{
int e = 1;
for(int i=1;i<=x;i++)
{
e = e * n;
}
printf("%d",e);
}
Storage Class(Automatic and External).
i)
#include
<stdio.h>
#include
<conio.h> void
add();
void main()
{
clrscr();
add();
getch();
}
void add()
{
auto int a = 5, b = 3,
sum; sum = a + b;
printf("The addition is: %d", sum);
}
ii)
#include
<stdio.h>
#include
<conio.h> void
add();
extern int a = 5, b
= 4; void main()
{
clrscr();
add();
getch();
}
void add()
{
int sum;
sum = a +
b;
printf("The sum is: %d", sum);
}
Recursive Functions.
i)
#include<stdio.
h>
#include<conio
.h> int fact(int
n);
void main()
{
int n;
clrscr();
printf("Enter the value of n: ");
scanf("%d",&n);
printf("The factorial of %d is %d",n,
fact(n)); getch();
}
int fact(int n)
{
if(n==0)
{
return 1;
}
else
{
return (n * fact(n-1));
}
}
ii)
#include<stdio.
h>
#include<conio
.h> int fib(int
n);
void main()
{
int i,n;
clrscr();
printf("Enter the value of n: ");
scanf("%d,",&n);
for (i=0; i<n; i++)
{
printf("%d", fib(i));
}
getch();
}
int fib(int n)
{
if(n==0 || n==1)
{
return
n; }
else
{
return (fib(n-1)+fib(n-2));
}}
Simple Programs Using Structure.
i)
#include<stdio.
h>
#include<conio
.h> struct
student{
int roll;
char name[20];
}s;
void main()
{
clrscr();
printf("Enter roll
number: ");
scanf("%d",&s.roll);
printf("Enter name: ");
scanf("%s",s.name);
printf("Roll number is: %d\
n",s.roll); printf("Name is:
%s",s.name); getch();
}
ii)
#include
<stdio.h>
#include
<conio.h>
struct employee
{ int emp_id;
char name[20];
char
address[30]; int
salary;
}s;
void main()
{ clrscr();
printf("Enter an employee
ID: "); scanf("%d",
&s.emp_id); printf("Enter
your name: "); scanf("%s",
s.name); printf("Enter
address: "); scanf("%s",
s.address); printf("Enter
salary: "); scanf("%d",
&s.salary);
printf("Your employee ID: %d\n",
s.emp_id); printf("Your name is: %s\
n", s.name); printf("Your address is:
%s\n", s.address); printf("Your salary
is: %d\n", s.salary); getch();
}
iii)
#include
<stdio.h>
#include
<conio.h>
struct customer
{ char
acc_no[10];
char name[20];
int balance;
}s;
void main()
{ clrscr();
printf("Enter account
no: "); scanf("%s",
s.acc_no); printf("Enter
name: "); scanf("%s",
s.name); printf("Enter
balance: ");
scanf("%d",
&s.balance);
printf("Account no is: %s\n",
s.acc_no); printf("Name is: %s\n",
s.name); printf("Balance is: %d\n",
s.balance); getch();
}
iv)
#include
<stdio.h>
#include
<conio.h>
struct std {
int roll;
float marks;
char
name[20];
}u;
void main()
{ clrscr();
printf("The size of structure is %d",
sizeof(u)); getch();
}
Array with Structure.
i)
#include
<stdio.h>
#include<conio
.h> struct
employee
{
char post[30];
char name[20];
float salary;
int id;
}e[2];
void
main() {
int i;
clrscr();
for (i = 0; i < 2; i++)
{
printf("Enter the employee
ID: "); scanf("%d", &e[i].id);
printf("Enter name: ");
scanf("%s", e[i].name);
}
printf("The output is:\
n"); for (i = 0; i < 2;
i++)
{
printf("The employee ID is: %d\n",
e[i].id); printf("Your name is: %s\n",
e[i].name);
}
getch();
}
ii)
#include
<stdio.h>
#include
<conio.h>
struct student
{
int symbol;
char
name[20];
char
address[30]; int
age;
}s[2];
void main()
{
int i;
clrscr();
for (i = 0; i < 2; i++)
{
printf("Enter symbol:
"); scanf("%d",
&s[i].symbol);
printf("Enter age: ");
scanf("%d", &s[i].age);
}
for (i = 0; i < 2; i++)
{
if (s[i].age > 16 && s[i].age < 30)
{
printf("Symbol no is: %d\n",
s[i].symbol); printf("Age is: %d\n",
s[i].age);}}
getch();
}
iii)
#include
<stdio.h>
#include
<conio.h>
struct employee
{ int symbol_no;
char name[2];
int age;};
void
main() {
struct employee
e[2]; int i;
clrscr();
for (i = 0; i < 2; i++)
{ printf("Enter symbol no:
"); scanf("%d",
&e[i].symbol_no);
printf("Enter name: ");
scanf("%s", e[i].name);}
printf("\nEmployee Details:\
n"); for (i = 0; i < 2; i++) {
printf("Symbol no: %d\n",
e[i].symbol_no); printf("Name: %s\
n", e[i].name);}
getch();}
Union(To find the size of union).
i)
#include <stdio.h>
//#include
<conio.h> union
std {
int roll;
float marks;
char
name[20];
}u;
void main() {
//clrscr();
printf("The size of union is %d", sizeof(u));
//getch();
}
Simple Program using Pointer.
i)
#include
<stdio.h>
#include
<conio.h> void
main()
{
int a =
5; int
*p;
clrscr()
;p=
&a;
printf("The value of a is: %d\n", a);
printf("The address of a is: %u\n", &a);
printf("The value of a using pointer is: %d\n",
*(&a)); printf("The value of p (address of a)
is: %u\n", p); printf("The address of p is: %u\
n", &p);
printf("The value stored at the address of p is: %u\n",
*(&p)); getch();
}
ii)
#include
<stdio.h>
#include
<conio.h> void
main()
{
int a, b, add, *p, *q;
clrscr();
printf("Enter value of a and b:
"); scanf("%d %d", &a, &b);
p = &a;
q = &b;
add = *p + *q;
printf("The addition is: %d",
add); getch();
}
iii)
#include
<stdio.h>
#include
<conio.h> void
main()
{
int a, b, *p, *q;
clrscr();
printf("Enter two
numbers: "); scanf("%d
%d", &a, &b);
p = &a;
q = &b;
if (*p > *q)
printf("%d is greater",
*p); else
printf("%d is greater",
*q); getch();
}
iv)
#include
<stdio.h>
#include
<conio.h> void
main() {
int p, t, r, *a, *b,
*c; float si;
clrscr();
printf("Enter principal, rate, and time:
"); scanf("%d %d %d", &p, &r, &t);
a = &p;
b = &t;
c = &r;
si = (*a * *b * *c) / 100.0;
printf("The simple interest is: %.2f",
si); getch();
}
v)
#include
<stdio.h>
#include
<conio.h> void
main()
{
int n,
*a;
clrscr()
;
printf("Enter a
number: ");
scanf("%d", &n);
a = &n;
if (*a > 0)
printf("%d is positive.",
*a); else if (*a < 0)
printf("%d is
negative.", *a); else
printf("%d is zero.",
*a); getch();
}
Call by Value and Call by Reference.
i)
#include
<stdio.h>
#include
<conio.h> void
fun(int a, int b);
void main() {
int a = 10, b =
20; clrscr();
fun(a, b);
printf("a = %d\t b = %d\n", a,
b); getch();
}
void fun(int a, int b) {
a = 20;
b = 10;
printf("Inside function: a = %d\t b = %d\n", a, b);
}
ii)
#include <stdio.h>
#include
<conio.h> void
fun(int *a, int *b);
void main() {
int a = 10, b =
20; clrscr();
fun(&a, &b);
printf("a = %d\t b = %d\n", a,
b); getch();
}
void fun(int *a, int *b) {
*a = 20;
*b = 10;
printf("Inside function: a = %d\t b = %d\n", *a, *b);
}
Simple File Handling Program.
i)
#include
<stdio.h>
#include
<conio.h> void
main() {
FILE
*fp; int
age;
char name[20];
clrscr();
fp = fopen("info.txt",
"w"); printf("Enter the
age: "); scanf("%d",
&age); printf("Enter
the name: ");
scanf("%s",name);
fprintf(fp, "%d %s", age,
name); fclose(fp);
printf("\NHARSHIT SINGH\nGRADE XII-M2");
getch();
}
ii)
#include
<stdio.h>
#include
<conio.h> void
main() {
FILE
*fp; int
roll;
char name[20], address[30];
clrscr();
fp = fopen("student.dat",
"w"); printf("Enter roll
number: ");
scanf("%d",&roll);
printf("Enter name: ");
scanf("%s",&name);
printf("Enter address: ");
scanf("%s",&address);
fprintf(fp, "%d\n%s\n%s\n", roll, name,
address); fclose(fp);
printf("\NHARSHIT SINGH\nGRADE XII-M2");
getch();
}
Reading/ Writing with File.
i)
#include
<stdio.h>
#include
<conio.h> void
main() {
FILE
*fp; int
i,id;
char name[20], address[30];
clrscr();
fp = fopen("employee.dat",
"w"); for(i=1;i<=2;i++)
{
printf("Enter employee
id: "); scanf("%d",&id);
printf("Enter name: ");
scanf("%s",&name);
printf("Enter address:
");
scanf("%s",&address);
fprintf(fp, "%d\n%s\n%s\n", roll, name, address);
}
fclose(fp);
printf("\NHARSHIT SINGH \nGRADE XII-M2");
getch();
}
ii)
#include
<stdio.h>
#include
<conio.h> void
main() {
FILE
*fp; int
i,id;
char name[20], address[30];
clrscr();
fp =
fopen("employee.dat",
"r"); for(i=1;i<=2;i++)
fscanf(fp, "%d%s%s", &id, name,
address); printf("Your employee id is
%d.\n ",&id); printf("Your name is %d.\
n ",name); printf("Your address is %d.\
n ",address);
fclose(fp);
printf("\nHARSHIT SINGH \nGRADE XII-M2");
getch();
}
iii)
#include
<stdio.h>
#include
<conio.h> void
main() {
FILE
*fp; int
i,id;
char
name[20];
int sal;
clrscr();
fp = fopen("emp.txt",
"w"); for(i=1;i<=2;i+
+)
printf("Enter employee
id: "); scanf("%d",&id);
printf("Enter name: ");
scanf("%s",name);
printf("Enter salary: ");
scanf("%d",&sal);
fprintf(fp, "%d,%s,%d", id, name, sal);
fclose(fp);
fp =
fopen("emp.txt", "r");
for(i=1;i<=2;i++)
P a g e 1 | 67
fscanf(fp, "%d%s%d", &id, name,&sal);
P a g e 2 | 67
printf("Your employee id is %d.\n ",id);
printf("Your name is %s.\n ",name);
printf("Your address is %d.\n ",sal);
fclose(fp);
printf("\NHARSHIT SINGH \nGRADE XII-M2");
getch();
P a g e 3 | 67
iv)
#include
<stdio.h>
#include
<conio.h> void
main() {
FILE
*fp; int
i,id;
char name[20];
char
subject[10];
clrscr();
fp = fopen("teacher.txt", "w");
P a g e 4 | 67
for(i=1;i<=2;i++)
printf("Enter teacher
id: "); scanf("%d",&id);
printf("Enter name: ");
scanf("%s",name);
printf("Enter subject:
"); scanf("%s",subject);
fprintf(fp, "%d%s%s", id, name, subject);
}
fclose(fp);
fp = fopen("teacher.txt", "r");
for(i=1;i<=2;i++)
fscanf(fp, "%d%s%s", &id, name,
subject); printf("Your teacher id is %d.\
n ",&id); printf("Your name is %d.\n
",name); printf("Your subject is %d.\n
",subject);
fclose(fp);
printf("\NHARSHIT SINGH \nGRADE XII-M2");
getch();
P a g e 5 | 67
P a g e 6 | 67
2. WEB DESIGNING
HTML AND JavaScript
HTML stands for Hyper Text Markup
Language. It is used to design web pages
using markup language. HTML is the
combination of Hypertext and Markup
language. Hypertext defines the link between
the web pages. Markup language is used to
define the text document within tag which
defines the structure of web pages. Most of
markup languages are human
readable. Language uses tags to define what
manipulation has to be done on the text. HTML is a
markup language which is used by the browser to
manipulate text, images and other content to
display it in required format. HTML was created by
Tim Berners-Lee in 1991.
Steps to open HTML:
i. Open your Computer.
ii.Click on windows tab and search for Notepad++ or Notepad.
Alternatively,
i. Press Windows + R.
ii.After run command appears, type Notepad++ or Notepad.
iii.Your Blank page will be opened.
P a g e 7 | 67
Simple Program using JavaScript.
i)
<html>
<head><title>Using JS</title></head>
<body>
Hello
World!
<button type="button" onclick="window.alert('This is inline
jss.');">Click me</button>
</body>
</html>
ii)
<html>
<head><title>Using JS</title></head>
<body>
Hello
World!
<script type="text/javascript">
document.write('Hello Again! and this is internal jss.');
</script>
</body>
</html>
P a g e 8 | 67
iii)
<html>
<head><title>External JS</title></head>
<body
> Yo!
<script src="one.js">
</script>
</body>
</html>
one.js:
document.write("KAIZOKOU!!");
P a g e 9 | 67
Using Control Structure (if, if-else, if-else-if, switch case).
i)
<html>
<head><title> using if statement </title> </head>
<body>
<script>
var age = parseInt(prompt("Enter Your
Age:")); if (age>=18)
{
document.write("You are eligible for voting");
}
</script>
</body>
</html>
ii)
<html>
<head> <title> using if-else statement </title> </head>
<body>
<script>
var n=parseInt(prompt ("Enter a
number")); if(n%2==0)
document.write("The number is even.");
}
else
{
document.write("The number is odd.");
}
</script>
</body>
</html>
iii)
<html>
<head><title> using if-else-if statement </title></head>
<body>
<script>
var n=parseInt(prompt("Enter a
number:")); if(n>0)
{
document.write("The number is positive");
}
else if(n<0)
document.write("The number is negative");
}
else
{
document.write ("The number is equal to zero.");
}
</script>
</body>
iv)
<html>
<head><title>Using switch statement</title></head>
<body>
<script>
var day=parseInt(prompt("Enter a number between 1 to
7:")); switch(day)
{
case 1:
document.write("Sunda
y"); break;
case 2:
document.write("Monda
y"); break;
case 3:
document.write
("Tuesday"); break;
case 4:
document.write("Wednesday");
break;
case 5:
document.write
("Thursday"); break;
case 6:
document.write("Frida
y"); break;
case 7:
document.write("Saturday");
break;
default:
document.write("Invalid days! Please insert 1-7 only!");
}
</script>
</body>
</html>
P a g e 13 | 67
v)
<html>
<head><title>Using switch statement</title></head>
<body>
<script>
var letter = prompt("Enter a letter:")
P a g e 14 | 67
switch(letter)
{
case 'a':
document.write("The letter is a
vowel."); break;
case 'e':
document.write("The
letter is a vowel.");
break;
case 'i':
document.write("The letter is a
vowel."); break;
case 'o':
document.write("The letter is a
vowel."); break;
case 'u':
document.write("The letter is a
vowel."); break;
default:
document.write("The letter is a consonant.");
}
</script>
</body>
</html>
vi)
<html>
<head> <title> using if-else statement </title> </head>
<body>
<script>
var n=parseInt(prompt ("Enter a
number")); if(n%5==0)
{
document.write("The number is divisible by 5.");
}
else
{
document.write("The number is not divisible by 5.");
}
</script>
</body>
</html>
Using Loop (for, while and do-while loop)
i)
<html>
<head> <title> using for loop </title> </head>
<body>
<script>
var fname = prompt("Enter your first
name:"); var Iname = prompt(" Enter
your last name:"); var i = 0;
for(i ; i <= 5; i++)
{
document.write(fname + "
"+Iname);
document.write("<br>");
}
</script>
</body>
<html>
ii)
<html>
<head> <title> using while loop</title> </head>
<body>
<script>
var n = prompt("Enter number of
terms:"); var i = 0;
while(i <= n)
{
document.write(i *
i+","); i = i + 1;
}
</script>
</body>
<html>
iii)
<html>
<head> <title> using do-while loop</title> </head>
<body>
<script>
var n = prompt("Enter number of
terms:"); var i = 0;
do
{
document.write(2 * i + 1
+ ","); i = i + 1;
}while(i <= n);
</script>
</body>
<html>
Function in JavaScript / Object
i)
<html>
<head> <title> using function</title> </head>
<body>
<script>
function f1()
{
document.write("Hello Guys!");
}
f1()
;
</script>
</body>
</
html>
ii)
<html>
<head> <title> using functions</title></head>
<body>
<script>
var fname = prompt("Enter your first
name:"); var lname = prompt(" Enter
your last name:"); function
f1(fname,lname)
{
document.write("My name is"+" "+fname + " "+lname);
}
f1(fname,lname);
</script>
</body>
</html>
Event Handling in JS
i)
<head>
<title>
Event Handling in JS
</title>
</head>
<body>
Hello World!
<button type="button"
onclick="window.alert('Booo!');">Click me</button>
</body>
ii)
<head>
<title>
Event Handling in JS
</title>
</head>
<body>
Hello World!
<button type="button"
onmouseover="window.alert('Booo
Again!');">Spooky</button>
</body>
Form Validation.
i)
<html>
<head> <title> Using form validation </title> </head>
<body>
<script>
function f1()
{
var a=
document.getElementById("u1").value;
var b=
document.getElementById("p1").value;
var c=
document.getElementById("p2").value;
if (a=="" || b=="")
{
alert("Blank valve isn't
allowed!"); return false;
}
else if (b.length <5)
{
alert("Password must be 5 characters
long!"); return false;
}
else if (b!=c)
{
alert("Passwords don't match!")
return false;
}
else
{
return true;
}
}
</script>
<form onsubmit="return f1()" action="name.html">
<fieldset>
<legend> LOGIN FORM </legend>
Username: <input type="textbox" id="u1"> <br>
<br> Password: <input type="password"
id="p1"><br><br> Confirm password: <input
type="password" id="p2"><br><br>
<input type="submit" value="submit">
<input type="reset" value="Clear">
</fieldset>
</form>
</body>
</html>
3. DATABASE
MANAGEME
NT XAMPP:
Database Management Software are the
software that are used to input, manage and
delete data and information according to the
user’s requirement. DBMS provide a easy way
to access and manipulate data and
information. MySQL is an open-source DBMS
used in many places around the world due to
its simplicity and easy to understand
interface. It uses SQL, short for
Structured Query Language, as the language to manipulate data
and information.
Steps to open TURBOC++:
i. Open your Computer.
ii.Click on windows tab and search for XAMPP.
iii.Click on XAMPP to open the XAMPP control panel.
iv. Click start on MySQL and Apache.
v.Go to your web browser and search “Localhost” or click on
Admin in the XAMPP control on panel.
vi.MySQL is now ready to use.
a) Create a Database.
CREATE DATABASE Employee;
b) Create a table.
CREATE TABLE Emp ( SN int, Name varchar(20), Post
varchar(2 5), Salary int);
c) Insert values into table.
INSERT INTO emp(SN,Name,Post,Salary) VALUES(1,"Anu","CE
O",25000), (2,"Princess","Managing
Director",15000), (3,"Rosy","Field Inspector",10000), (4,"Agent
Ro","Project Manager",20000), (5,"Kei","Advertisment
Manager",15000);
d) Select value from table.
SELECT Name, Salary FROM emp WHERE Name LIKE "A%";
e) Update the value from table
UPDATE emp SET Name = "Karuizawa" WHERE Name = "Kei";
f) Delete the value from table.
DELETE FROM `emp` WHERE Salary = 10000;
CONCLUSION:
By preparing this project I came to know about different software
and their usages like C-Programming, JavaScript and MySQL. I learnt
the different features of all the software that I have used. Using C, I
learnt to make various programs using functions, recursive functions
and also programs to manipulate data files. Using JavaScript, I learnt
to prepare fluid webpages. I came to know about the different
facilities provided by web-page designing and also came to know
about its real-life usages. Using MySQL, I learnt to store, manipulate
and delete data and information using Standard Query Language.
I felt very glad while preparing this report. I would like to present my
humblest of gratitude to those who helped me complete this project,
my friends and my teachers of the Computer Science Department,
especially our HOD Roshan Dangi sir, who gave me great
suggestions on ways to improve the project.
BIBLIOGRAPHY:
1. Dangi, Roshan (2022), A Text Book of Computer Science-XI,
Heritage Publication
WEB REFERENCES:
1. https://www.google.com
2. https://www.wikipedia.org
3. https://w3schools.co