Copy of Computer Project 3
Copy of Computer Project 3
PROJECT WORK
(COMPUTER SCIENCE)
Kathmandu, Nepal
2025
A Project On
C Programming, Java Script and Database
Management
Submitted By:
Nitya Kaphle
Under Supervision Of
Dhirendra Kumar Yadav
Date:
27 February, 2025
Certificate
This is to certify that Mr./Ms. ……………………………………
has successfully completed his/her project work
as per the requirement of the curriculum of
GRADE-XII (Computer Science) under National
Education Board, Nepal. He/ She has completed
his/her project work within the prescribed period.
_______________ _______________
(Internal Examiner) (External Examiner)
Table of Content
Title Page No.
A. C programming 1-22
C. Database Management 36 – 38
D. Conclusion 39
E. Bibliography 40
A. C Programming
1. Function
2. Structure/Union
3. Pointer
4. File Handling
B. JavaScript
Event Handling in JS 2
Form Validation 1
C. Database Management
Create a Database 1
Create a Table 1
A.C-Programming
1. Function
i) Function related programs
a) Program to add to numbers using Function
#include <stdio.h>
int add(int a, int b) {
return a + b;
}
int main() {
int num1 = 5, num2 = 10;
printf("Sum: %d\n", add(num1, num2));
return 0;
}
b) Program to find the maximum of two numbers using a
function:
#include <stdio.h>
int max(int a, int b) {
return (a > b) ? a : b;
}
int main() {
int num1 = 5, num2 = 10;
printf("Max: %d\n", max(num1, num2));
return 0;
}
2. Structure / Union
i) Simple program using structure
a) Program to store and display student details:
#include <stdio.h>
struct Student {
char name[50];
int roll;
float marks;
};
int main() {
struct Student s1 = {"John", 101, 95.5};
printf("Name: %s\nRoll: %d\nMarks: %.2f\n", s1.name, s1.roll,
s1.marks);
return 0;
}
increment(&num);
printf("Value of num is: %d", num);
return 0;
}
4. File Handling
i) Simple program
a) Program to create a file and write data into it:
#include <stdio.h>
int main() {
FILE *file = fopen("example.txt", "w");
fprintf(file, "Hello, World!");
fclose(file);
printf("File created and data written.\n");
return 0;
}
b) Program to read data from a file:
#include <stdio.h>
int main() {
FILE *file = fopen("example.txt", "r");
char ch;
while ((ch = fgetc(file)) != EOF) {
printf("%c", ch);
}
fclose(file);
return 0;
}
B) JavaScript
1) Simple Program using JavaScript
a) Program to display "Hello, World!":
<!DOCTYPE html>
<html>
<body>
<script>
document.write("Hello, World!");
</script>
</body>
</html>
b) Program to add two numbers and display the result:
<!DOCTYPE html>
<html>
<body>
<script>
let num1 = 5, num2 = 10;
document.write("Sum: " + (num1 + num2));
</script>
</body>
</html>
<label for="name">Name:</label><br>
<input type="text" id="name" name="name"><br>
<span id="nameError" class="error"></span><br><br>
<label for="email">Email:</label><br>
<input type="text" id="email" name="email"><br>
<span id="emailError" class="error"></span><br><br>
<label for="password">Password:</label><br>
<input type="password" id="password" name="password"><br>
<span id="passwordError" class="error"></span><br><br>
<script>
function validateForm() {
document.getElementById("nameError").innerHTML = "";
document.getElementById("emailError").innerHTML = "";
document.getElementById("passwordError").innerHTML = "";
</body>
</html>
C. Database Management
Database Management involves the efficient and organized
handling of data within a database system. This process includes
creating, updating, retrieving, and managing data while ensuring
its integrity, security, and accessibility.
Here are key aspects of Database Management:
1. Database Systems: - A database is a structured collection of
data organized in a way that facilitates efficient retrieval and
manipulation. Database management systems (DBMS) are software
applications that provide an interface to interact with databases.
1: Create a database
CREATE DATABASE EMPLOYEE;
2: Create a table
CREATE TABLE EMPLOYEE (
empId INTEGER PRIMARY KEY,
name TEXT NOT NULL, dept
TEXT NOT NULL
);
In conclusion, our project work has equipped us with the skills and
knowledge required to develop sophisticated web applications, system
software, and database-driven solutions. These competencies are
invaluable for aspiring software developers, and we feel well-prepared
to implement them in practical, real-world situations.
Bibliography
References: