0% found this document useful (0 votes)
58 views66 pages

Result Sample Templete in MS WORD

The document is a project report submitted by Suvanjan Prasai for grade 11 computer science. It contains 5 MS Word programs, 2 MS Excel programs, 1 MS PowerPoint program, and various HTML, CSS and C programming examples covering different topics as required by the curriculum.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views66 pages

Result Sample Templete in MS WORD

The document is a project report submitted by Suvanjan Prasai for grade 11 computer science. It contains 5 MS Word programs, 2 MS Excel programs, 1 MS PowerPoint program, and various HTML, CSS and C programming examples covering different topics as required by the curriculum.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 66

GLOBAL SCHOOL

OF SCIENCE

PROJECT WORK OF
COMPUTER SCIENCE

Submi Submi
tted tted to:
by: Name:
Name: Roshan
Suvanja Dangi
n Prasai Departm

KATHMANDU, NEPAL
2024

Suvanjan Prasai GSS Page 1


A PROJECT ON
Ms-Word | Ms-PowerPoint | HTML | CSS &
C Programming

Submitted as a partial fulfillment of requirement of the


curriculum of GRADE-XI (Computer Science) under National
Education Board, Nepal

Submitted by:
Suvanjan Prasai

Under Supervision of
Roshan Dangi

Date: April 5, 2024

Global
School
Of
science
Mid

Suvanjan Prasai GSS Page 2


GLOBAL SCHOOL OF SCIENCE

Certificate
This is to certify that Mr./Ms. has successfully completed his/her
project work as per the requirement of the curriculum of
GRADE-XI (Computer Science) under National Education
Board, Nepal. He/ She has completed his/her project work
within the prescribed period.
NEB Symbol no/Registration no.:

Internal Externa
Examin l
Date: April 5, 2024

Suvanjan Prasai GSS Page 3


Table of Content
Title Page
No.
A. 7

Ms- 11

W 15

or 23

d 35

B. 82

Ms- 83

xc

Suvanjan Prasai GSS Page 4


Topic coverage in Project

Section Topic/ Subtopic No. of programs

A MS-Word

Ms-Word Experiment 4

B Ms-Excel

Ms-Excel Experiment 4
C Ms-PowerPoint

Ms-PowerPoint Experiment 1

D HTML/ CSS

Heading Tag 1
Text Formatting/ Character 1
Formatting
Font Tag 1
Inserting Image 1
Inserting Audio/ Video 1

Hyperlink 1

Inserting table 1
List Tag 2
Form Tag 1

CSS: Internal/External/ Inline 3

Suvanjan Prasai GSS Page 5


E C Programming

Simple Program 7

I/O function in C 3

If statement 1

If … else statement 3

If…else if statement 3

Nested if…else statement 1

Switch case 3

For loop 3

While loop 3

Do…while loop 3

Break statement 1

Continue statement 1

Go to statement 1

Array 6

String Function 7

Suvanjan Prasai GSS Page 6


MS WORD
Program 1: Congratulation card to a friend

CONGRATULATI
ONS
Dear Ram,
Congratulations on your outstanding achievement! Becoming the top scorer in the board
exams is no small feat, and your hard work and dedication have truly paid off.
May this success be the stepping stone to a bright future filled with even greater
accomplishments. Keep shining, keep striving, and keep making us proud!
Warm regards,
Suvanjan Prasai

Suvanjan Prasai GSS Page 7


Program 2: Curriculum Vitae (C.V.)

Suvanjan Prasai

Experience
2015–2019
IT Engineer• Senior Developer • Esewa
2019–2020
IT Engineer• HOD • Daraz
2020–2023
It Engineer• Senior Engineer • Meta

Mid-Baneshwor I have had worked on plenty of tech giants as a software engineer as


Kathmandu,44600 you can already see on the above column.

9860051561 Education
St. Joseph Secondary School, Biratnagar, Morang
education@suvanjanpras I have scored 3.65 as grade point average on the recent SEE
ai.com.np examination conducted by NEB.

Communication
 Excellent written and verbal communication skills
 Confident, articulate, and professional speaking abilities (and
experience)
 Empathic listener and persuasive speaker
 Writing creative or factual
 Speaking in public, to groups, or via electronic media
 Excellent presentation and negotiation skills
suvanjanprasai.com.np

Leadership
 Able to lead others in high-demand situations
 Coaching, guiding, or tacking
 Delegating tasks or responsibilities
 Demonstrated leadership
 Evaluating performance, programs, processes, or events

Suvanjan Prasai GSS Page 8


Program 3: Birthday Card using different shapes

HAPPY
BIRTHDA
Y
MONDAY, 1
7`O APRIL
CLOCK IN THE
EVENING
BASUKI MARG, BANESHWOR

Suvanjan Prasai GSS Page 9


Program 4: Report card of student’s result

STUD
ENT
Name: Suvanjan Prasai Grade: 11

Section: Q

Date: 05/04/2024

Subject P.M. F.M. Obtained

Math 40 100 92

Computer 40 100 96

Chemistry 40 100 86

Physics 40 100 93

English 40 100 84

Nepali 40 100 82

Teacher’s Feedback:
_______________________________________________________________________________
_______________________________________________________________________________

Class Teacher Signature Principal Signature Parent’s Signature


_____________________ _________________ ________________

Suvanjan Prasai GSS Page 10


MS EXCELL
Program 1: Calculate result of students

Formula:
Total: =SUM (B2:G2)
Percentage: =H2/600*100
Remark: =IF(AND(B2>=40, C2>=40, D2>=40,
E2>=40),"Pass”, “Fail")

Suvanjan Prasai GSS Page 11


Program 2: A calendar using several designs

Process:
1. Open Excel and create a new spreadsheet.
2. Enter the dates you want to include in the calendar in one column.
3. In another column, label each date with the corresponding day of the week using Excel's
"Weekday" function.
4. Format the cells to display as dates and days of the week, adjusting fonts and colors as
desired.
5. Use conditional formatting or other tools to highlight specific dates, holidays, or events
on the calendar.

Suvanjan Prasai GSS Page 12


Program 3: A template of bill

Process:
1. Open Excel and create a new spreadsheet.
2. Designate columns for item description, quantity, unit price, total price, and any
additional fields you need.
3. Input your billing items and their respective details into the designated columns.
4. Use formulas to calculate the total price for each item and the overall bill total.
5. Format the bill template for clarity and professionalism, including company logo, contact
information, and any necessary legal disclaimers.

Suvanjan Prasai GSS Page 13


Program 4: Student database sample

Process:
1. Open Excel and create a new spreadsheet.
2. Label columns for Name, Roll Number, Class, Guardians, and Fees Due.
3. Enter student information into the respective columns, including their name, roll number,
class, guardians' names, and any fees due.
4. Format the spreadsheet for clarity, using borders and headers to distinguish columns.
5. Utilize Excel's sorting and filtering functions to easily manage and update the student
database as needed.

Suvanjan Prasai GSS Page 14


POWER POINT
Program 1: Presentation on mathematics

Suvanjan Prasai GSS Page 15


Suvanjan Prasai GSS Page 16
Suvanjan Prasai GSS Page 17
Suvanjan Prasai GSS Page 18
Suvanjan Prasai GSS Page 19
Suvanjan Prasai GSS Page 20
Suvanjan Prasai GSS Page 21
Rajendra Prasad Joshi GSS Page 22
Suvanjan Prasai GSS Page 54
Suvanjan Prasai GSS Page 68
HTML
HTML, which stands for HyperText Markup Language, is the
standard markup language used to create web pages. It provides
a structured way to organize and format content on the World
Wide Web (WWW). Here's a brief introduction to HTML's
background and characteristics:

HTML was first developed by Tim Berners-Lee in 1990 while


working at CERN (European Organization for Nuclear
Research) in Switzerland. It was initially created as a simple
markup language to facilitate the sharing and exchange of
scientific documents among researchers. Over time, HTML
evolved into a widely adopted standard for creating web pages,
playing a crucial role in the growth and development of the
World Wide Web.

Characteristics:

1. Markup language
2. Platform-Independent
3. Text-Based-Format
4. Semantics
5. Extensible
6. Integration with other technologies
1.Heading tag
In HTML, the <h1> to <h6> tags are used to define headings of different levels,
ranging from the most important <h1> to the least important <h6>. These tags are part
of the semantic markup in HTML and are used to structure and organize content on a
web page.

<!DOCTYPE html>
<html>
<body>

<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>

</body>
</html>

Text Formatting/ Character Formatting


In HTML, you can apply text formatting and character
formatting using various elements and attributes to style
and enhance the appearance of text on a web page.

<!DOCTYPE html>
<html>
<body>

<p><b>This text is bold</b></p>


<p><i>This text is italic</i></p>
<p>This is<sub> subscript</sub> and <sup>superscript</sup></p>

</body>
</html>

Font tag

The <font> tag is an HTML element that was used in older


versions of HTML to specify the font, color, and size of text
within a web page.

<!DOCTYPE html>
<head>
<title>Document</title>
</head>
<body>
<font face="Cursive" size="6"> Did you see it ? </font>
</body>
</html>

Inserting Image
<!DOCTYPE html>
<html>
<body>

<h2>Watch Out</h2>

<img src="https://media.istockphoto.com/id/637696304/photo/patan.jpg?
s=612x612&w=is&k=20&c=wesFCvNKd9X0yQ6jdGuAG-mqMICB1dI_B21Ac9PwWFY="
alt="W3Schools.com" >

</body>
</html>
Inserting Audio/ Video

<!DOCTYPE html>
<head>
<title>Document</title>
</head>
<body>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
</video>
</body>
</html>

Hyperlink
<!DOCTYPE html>
<html>
<body>

<h1>HTML Links</h1>

<p><a href="https://www.youtube.com/">Visit Youtube</a></p>

</body>
</html>
HTML Table

HTML tables are used to organize and display data in rows and columns on a web
page. They are created using the <table>, <tr>, <th>, and <td> elements.

<!DOCTYPE html>
<html>
<style>
table, th, td {
border:1px solid black;
}
</style>
<body>

<h2>A basic HTML table</h2>

<table style="width:100%">
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Mega</td>
<td>Maria Anders</td>
<td>Nepal</td>
</tr>
<tr>
<td>Derex</td>
<td>Harry Bing</td>
<td>USA</td>
</tr>
</table>
</body>
</html>
LIST TAG

<!DOCTYPE html>
<html>
<body>

<h2>An ordered HTML list</h2>

<ol>
<li>Lamborghini</li>
<li>Ferrari</li>
<li>Mercedes-Benz</li>
</ol>

</body>
</html>

<!DOCTYPE html>
<html>
<body>

<h2>An unordered HTML list</h2>

<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>

</body>
</html>
HTML Form

HTML forms are used to collect user input on a web page. They
allow users to enter data such as text, numbers, selections, and
more, which can then be submitted to a server for processing.

<!DOCTYPE html>
<html>
<body>

<h2>HTML Forms</h2>

<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="Elon"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Musk"><br><br>
<input type="submit" value="Submit">
</form>

</body>
</html>
CSS
CSS, which stands for Cascading Style Sheets, is a style sheet
language used to define the presentation and layout of HTML
(or XML) documents. It allows web developers to control the
appearance of web pages, including aspects such as colors,
fonts, spacing, and positioning.

CSS is used to separate the presentation (visual style) of a web


page from its structure (HTML content) and behavior
(JavaScript functionality). By using CSS, web developers can
create consistent, visually appealing designs across multiple web
pages and devices without having to apply styling directly to
HTML elements.
<!DOCTYPE html>
<html>
<body>

<h1 style="color:blue;">A Blue Heading</h1>

<p style="color:red;">A red paragraph.</p>

</body>
</html>

<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: black;}
h1 {color: yellow;}
p {color: red;}
</style>
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>
<!DOCTYPE html> style.css
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body> body {
backgroun
<h1>Using External CSS</h1> d-color:
<p>MRX</p>
powderblu
</body> e;
</html> }
h1 {
color:
blue;

style.css

C programming

"C" is a general-purpose, procedural programming language originally


developed by Dennis Ritchie at Bell Labs in the early 1970s. It was
designed as a successor to the B programming language and was created
primarily for system programming tasks such as writing operating
systems. C has had a profound impact on the field of computer science
and software development and remains one of the most widely used
programming languages to this day.

C is known for its efficiency, flexibility, and close-to-the-hardware


nature, making it suitable for developing low-level systems software as
well as high-level application software. Its syntax is relatively simple and
concise, yet powerful, allowing developers to write compact and fast
code.

One of the key features of C is its ability to manipulate memory directly


through pointers, which gives programmers precise control over system
resources but also introduces the potential for errors such as memory
leaks and segmentation faults.
Over the years, C has influenced many other programming languages,
including C++, Objective-C, and even languages like Java and Python. It
serves as the foundation for many modern operating systems, including
Unix, Linux, and Windows.

Despite its age, C remains popular in various domains, including


embedded systems, game development, and system programming, where
performance and control are paramount. Its widespread use and enduring
relevance make it an essential language for any aspiring programmer to
learn.

Simple Program
1. //First C program
#include <stdio.h>

int main() {
printf("Hello World!");
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:

2. // WAP to add two numbers


#include <stdio.h>

int main() {
double num1, num2, sum;
printf("Enter first number: ");
scanf("%lf", &num1);
printf("Enter second number: ");
scanf("%lf", &num2);
sum = num1 + num2;
printf("Sum = %.2lf\n", sum);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}
Output:

3. //WAP to find area and circumference of circle


#include <stdio.h>

int main() {
double radius, area, circumference;
const double PI = 3.14159;

printf("Enter the radius of the circle: ");


scanf("%lf", &radius);

area = PI * radius * radius;


circumference = 2 * PI * radius;

printf("Area of the circle: %.2lf\n", area);


printf("Circumference of the circle: %.2lf\n", circumference);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:

4. //WAP to find area of rectangle


#include <stdio.h>

int main() {
double length, width, area;

printf("Enter the length of the rectangle: ");


scanf("%lf", &length);

printf("Enter the width of the rectangle: ");


scanf("%lf", &width);
area = length * width;
printf("Area of the rectangle: %.2lf\n", area);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:

5. // WAP to swap two numbers


#include <stdio.h>

int main() {
int a, b, temp;
printf("Enter two integers: ");
scanf("%d %d", &a, &b);
printf("Before swapping: a = %d, b = %d\n", a, b);
temp = a;
a = b;
b = temp;
printf("After swapping: a = %d, b = %d\n", a, b);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:

6. //WAP to find simple interst


#include <stdio.h>

int main() {
double principal, rate, time, simple_interest;

printf("Enter principal amount: ");


scanf("%lf", &principal);

printf("Enter rate of interest (per year): ");


scanf("%lf", &rate);

printf("Enter time period (in years): ");


scanf("%lf", &time);
simple_interest = (principal * rate * time) / 100;
printf("Simple interest = %.2lf\n", simple_interest);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:

7. //WAP to find area of triangle


#include <stdio.h>

int main() {
double base, height, area;

printf("Enter the base of the triangle: ");


scanf("%lf", &base);

printf("Enter the height of the triangle: ");


scanf("%lf", &height);

area = 0.5 * base * height;


printf("Area of the triangle: %.2lf\n", area);
printf("\n***Coded By:Rajendra Prasad Joshi***");

return 0;
}

Output:
I/O function in C

In C programming, input and output (I/O) functions are fundamental for


interacting with users, reading from or writing to files, and
communicating with external devices. These functions are primarily part
of the Standard Input/Output Library, defined in the <stdio.h> header file.
They are: printf(), scanf(), putchar(), getchat(), fputs(), fgets(),etc.

1. //Use of printf() and scanf() functions


#include <stdio.h>

int main() {
int num;
printf("Enter an integer: ");
scanf("%d", &num);
printf("You entered: %d\n", num);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}
Output:

2. // use of fputs() and fgets() functions in string


#include <stdio.h>

int main() {
char str[100];
printf("Enter a string: ");
fgets(str, sizeof(str), stdin);
printf("You entered: ");
fputs(str, stdout);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:
3. // USing fetchar() and putchar() functions
#include <stdio.h>

int main() {
char ch;
printf("Enter a character: ");
ch = getchar();
printf("You entered: ");
putchar(ch);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:

IF
In C programming, the if statement is a fundamental control structure
used for decision-making. It allows you to execute a block of code
conditionally based on the evaluation of a boolean expression.

1. //WAP to find an integer is even or odd


#include <stdio.h>

int main() {
int num;

printf("Enter an integer: ");


scanf("%d", &num);
if (num % 2 == 0) {
printf("%d is even.\n", num);
}
if (num % 2 != 0) {
printf("%d is odd.\n", num);
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:
If … else statement
In C programming, the if-else statement is a powerful control structure
that allows you to execute different blocks of code based on the
evaluation of a boolean expression.

1. //WAP to determines whether a number is positive or negative.


#include <stdio.h>

int main() {
int num;

printf("Enter a number: ");


scanf("%d", &num);

if (num >= 0) {
printf("%d is a positive number.\n", num);
} else {
printf("%d is a negative number.\n", num);
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}
Output:
2. //WAP to find greatest among two numbers
#include <stdio.h>

int main() {
int num1, num2;

printf("Enter two numbers: ");


scanf("%d%d", &num1, &num2);

if (num1 >= num2) {


printf("%d is a greater.\n", num1);
} else {
printf("%d is a greater.\n", num2);
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

3. //WAP to check wheatet a person is eligible for voting or not


#include <stdio.h>

int main() {
int age;

printf("Enter your age:");


scanf("%d",&age);

if(age >= 18)


printf("You are eligible for voting");
else
printf("Come When you reach 18!!!");
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:

If…else if statement

In C programming, the if-else if-else statement is used when you have


multiple conditions to evaluate sequentially. It allows you to choose one
of several blocks of code to execute based on the outcome of multiple
conditions.

1. //WAP to find smallest among three numbers.


#include <stdio.h>

int main() {
int num1, num2, num3;

printf("Enter three numbers: ");


scanf("%d %d %d", &num1, &num2, &num3);

if (num1 <= num2 && num1 <= num3) {


printf("Smallest number: %d\n", num1);
} else if (num2 <= num1 && num2 <= num3) {
printf("Smallest number: %d\n", num2);
} else {
printf("Smallest number: %d\n", num3);
}

return 0;
}

Output:
2.//WAP to determine the sign of a integer.
#include <stdio.h>

int main() {
int num;

printf("Enter a number: ");


scanf("%d", &num);

if (num > 0) {
printf("Positive number\n");
} else if (num < 0) {
printf("Negative number\n");
} else {
printf("Zero\n");
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:

3.//WAP to determine age group.


#include <stdio.h>

int main() {
int age;
printf("Enter your age: ");
scanf("%d", &age);

if (age >= 0 && age <= 12)


printf("Child\n");
else if (age >= 13 && age <= 19)
printf("Teenager\n");
else if (age >= 20 && age <= 59)
printf("Adult\n");
else if (age >= 60)
printf("Senior Citizen\n");
else
printf("Invalid age\n");
printf("\n***Coded By:Rajendra Prasad Joshi***");

return 0;
}

output:

Nested if…else statement

In C programming, a nested if-else statement refers to the situation


where one if-else statement is nested within another. This allows for more
complex decision-making logic, where certain conditions need to be
evaluated only if the outer condition is true.

1. #include <stdio.h>

int main() {
int age;
char gender;

printf("Enter your age: ");


scanf("%d", &age);

printf("Enter your gender (M/F): ");


scanf(" %c", &gender);

if (age >= 18) {


if (gender == 'M') {
printf("You are a man.\n");
} else if (gender == 'F') {
printf("You are a woman.\n");
} else {
printf("Invalid gender.\n");
}
} else {
printf("You are not an adult yet.\n");
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

Switch case
In C programming, the switch statement provides a way to
control flow based on the value of a variable or expression. It's
an alternative to using multiple if-else statements when you
have multiple conditions to evaluate against the same variable.

1. WAP checks if a character entered by the user is a vowel or a consonant.


#include <stdio.h>

int main() {
char ch;
printf("Enter a character: ");
scanf(" %c", &ch);

switch(ch) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
printf("%c is a vowel.\n", ch);
break;
default:
printf("%c is a consonant.\n", ch);
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

2. //WAP to make simple calculator


#include <stdio.h>

int main() {
char operator;
double num1, num2, result;

printf("Enter an operator (+, -, *, /): ");


scanf(" %c", &operator);

printf("Enter two numbers: ");


scanf("%lf %lf", &num1, &num2);

switch(operator) {
case '+':
result = num1 + num2;
printf("Result: %.2lf\n", result);
break;
case '-':
result = num1 - num2;
printf("Result: %.2lf\n", result);
break;
case '*':
result = num1 * num2;
printf("Result: %.2lf\n", result);
break;
case '/':
if (num2 != 0) {
result = num1 / num2;
printf("Result: %.2lf\n", result);
} else {
printf("Error: Division by zero\n");
}
break;
default:
printf("Invalid operator\n");
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:

3. // WAP to print Day of a week


#include <stdio.h>

int main() {
int day;
printf("Enter a number (1-7): ");
scanf("%d", &day);

switch(day) {
case 1:
printf("Sunday\n");
break;
case 2:
printf("Monday\n");
break;
case 3:
printf("Tuesday\n");
break;
case 4:
printf("Wednesday\n");
break;
case 5:
printf("Thursday\n");
break;
case 6:
printf("Friday\n");
break;
case 7:
printf("Saturday\n");
break;
default:
printf("Invalid input\n");
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

FOR loop
In C programming, the for loop is a control flow statement used
to execute a block of code repeatedly for a fixed number of
times. It's particularly useful when you know the exact number
of iterations you want to perform.
1. //WAP to program to print from 1 to 5
#include <stdio.h>

int main() {
printf("Numbers from 1 to 5:\n");
for (int i = 1; i <= 5; ++i) {
printf("%d\n", i);
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:
2.//WAP to find Factorial of number
#include <stdio.h>

int main() {
int num;
int factorial = 1;

printf("Enter a positive integer: ");


scanf("%d", &num);

for (int i = 1; i <= num; ++i) {


factorial *= i;
}
printf("Factorial of %d = %d\n", num, factorial);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

3.//WAP print multiplication table .


#include <stdio.h>

int main() {
int num;
printf("Enter a number: ");
scanf("%d", &num);

printf("Multiplication table of %d:\n", num);


for (int i = 1; i <= 10; ++i) {
printf("%d x %d = %d\n", num, i, num * i); }
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:
While loop

In C programming, the while loop is a control flow statement that repeatedly


executes a block of code as long as a specified condition is true. It's useful when you
want to loop until a certain condition is no longer met.

1. //WAP to countdown from 5 to 1.


#include <stdio.h>

int main() {
int count = 5;
printf("Countdown from 5 to 1:\n");
while (count >= 1) {
printf("%d\n", count);
count--;
}
printf("Blast off!\n");
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:
2. //WAP to find sum of numbers from 1 to 100.
#include <stdio.h>

int main() {
int sum = 0, num = 1;

while (num <= 100) {


sum += num;
num++;
}
printf("Sum of numbers from 1 to 100: %d\n", sum);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:

3. //WAP to print even numbers from 1 to 20.


#include <stdio.h>

int main() {
int num = 2;

printf("Even numbers from 1 to 20:\n");


while (num <= 20) {
printf("%d\n", num);
num += 2;
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:
Do…while loop

In C programming, the do-while loop is a control flow statement


that executes a block of code at least once, and then repeatedly
executes the block as long as a specified condition is true.
Unlike the while loop, the do-while loop evaluates its condition
after the block of code has been executed, ensuring that the
block of code is executed at least once.

1.//WAP to find sum of numbers from 1 to 50.


#include <stdio.h>

int main() {
int sum = 0, num = 1;
do {
sum += num;
num++;
} while (num <= 50);
printf("Sum of numbers from 1 to 50: %d\n", sum);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:
2.//WAP to print odd number from 1 to 10.
#include <stdio.h>

int main() {
int num = 1;

printf("Odd numbers from 1 to 10:\n");


do {
printf("%d\n", num);
num += 2;
} while (num <= 10);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:

3. //WAP to find factorial


#include <stdio.h>

int main() {
int num, factorial = 1, i = 1;

printf("Enter a positive integer: ");


scanf("%d", &num);

do {
factorial *= i;
i++;
} while (i <= num);

printf("Factorial of %d = %d\n", num, factorial);


printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:
BREAK STATEMENT

In C programming, the break statement is used to exit a loop


prematurely. It can be used within for, while, or do-while loops,
as well as within switch statements. When the break statement is
encountered inside a loop or switch statement, the control flow
immediately exits the loop or switch block, and program
execution continues with the statement following the loop or
switch block.

1. //Demonstration of Break statement in loop


#include <stdio.h>

int main() {
for (int i = 1; i <= 10; ++i) {
printf("%d\n", i);
if (i == 5) {
break;
}
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

Continue STATEMENT
In C programming, the continue statement is used within loops
to skip the rest of the code in the current iteration and proceed to
the next iteration of the loop. When the continue statement is
encountered, the control flow immediately jumps back to the
beginning of the loop, skipping any remaining statements within
the loop body.

1.//Skip odd number


#include <stdio.h>

int main() {
for (int i = 1; i <= 10; ++i) {
if (i % 2 != 0) {
continue;
}
printf("%d\n", i);
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

Output:

Go to statement

In C programming, the goto statement is used to transfer control


unconditionally to another labeled statement within the same
function. While goto can be a powerful tool, its use is generally
discouraged because it can make code harder to understand and
maintain, and it can lead to unstructured and error-prone code.
#include <stdio.h>

int main() {
int num = 1;

start:
printf("Current value of num: %d\n", num);
num++;

if (num <= 5) {
goto start;
}
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

ARRAY

In C programming, an array is a collection of elements of the same data type, stored in


contiguous memory locations. Each element in the array can be accessed using an
index, which represents its position within the array. Arrays provide a convenient way
to store and manipulate multiple values of the same type.

1.//Sum of array element


#include <stdio.h>

int main() {
int numbers[] = {10, 20, 30, 40, 50};
int sum = 0;

for (int i = 0; i < 5; ++i) {


sum += numbers[i];
}

printf("Sum of array elements: %d\n", sum);


printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

2//WAP to Find Maximum Element in Array:


#include <stdio.h>

int main() {
int numbers[] = {10, 20, 30, 40, 50};
int max = numbers[0];

for (int i = 1; i < 5; ++i) {


if (numbers[i] > max) {
max = numbers[i];
}
}
printf("Maximum element in array: %d\n", max);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output

3. //print reverse of array


#include <stdio.h>

int main() {
int numbers[] = {10, 20, 30, 40, 50};

printf("Array in reverse order: ");


for (int i = 4; i >= 0; --i) {
printf("%d ", numbers[i]);
}
printf("\n");
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

4. //Check even number in arary.


#include <stdio.h>

int main() {
int numbers[] = {10, 21, 30, 45, 50};

printf("Even numbers in array: ");


for (int i = 0; i < 5; ++i) {
if (numbers[i] % 2 == 0) {
printf("%d ", numbers[i]);
}
}
printf("\n***Coded By:Rajendra Prasad Joshi***");

return 0;
}

output:

5. //Calculate average of array element


#include <stdio.h>

int main() {
int numbers[] = {10, 20, 30, 40, 50};
int sum = 0;

for (int i = 0; i < 5; ++i) {


sum += numbers[i];
}

float average = (float)sum / 5;


printf("Average of array elements: %.2f\n", average);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

6. //Reverse string
#include <stdio.h>
#include <string.h>

int main() {
char str[] = "Hello";
int length = strlen(str);

printf("Original string: %s\n", str);

for (int i = 0; i < length / 2; ++i) {


char temp = str[i];
str[i] = str[length - i - 1];
str[length - i - 1] = temp;
}

printf("Reversed string: %s\n", str);


printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

7. //count occurances of an element


#include <stdio.h>

int main() {
int numbers[] = {10, 20, 30, 20, 40, 20, 50};
int target = 20;
int count = 0;

for (int i = 0; i < 7; ++i) {


if (numbers[i] == target) {
count++;
}
}
printf("Number of occurrences of %d: %d\n", target, count);
printf("\n***Coded By:Rajendra Prasad Joshi***");

return 0;
}

output:

String Function

In C programming, strings are typically represented as arrays of


characters terminated by a null character '\0', which marks the
end of the string. C does not have a built-in string data type like
some other programming languages, so strings are commonly
manipulated using arrays of characters along with various string
manipulation functions.

1. //String length
#include <stdio.h>
#include <string.h>

int main() {
char str[] = "Hello, World!";
int length = strlen(str);
printf("Length of the string: %d\n", length);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

2. // WAP to copy string


#include <stdio.h>
#include <string.h>

int main() {
char source[] = "Hello";
char destination[20];
strcpy(destination, source);
printf("Copied string: %s\n", destination);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}
output:

3. //string concatenation output:


#include <stdio.h>
#include <string.h>

int main() {
char str1[] = "Hello";
char str2[] = " World!";
strcat(str1, str2);
printf("Concatenated string: %s\n", str1);
printf("\n***Coded By:Rajendra Prasad
Joshi***");
return 0;
}

1. string comparison output:


#include <stdio.h>
#include <string.h>

int main() {
char str1[] = "Hello";
char str2[] = "Hello";
if (strcmp(str1, str2) == 0) {
printf("Strings are equal.\n");
} else {
printf("Strings are not equal.\n");
}
printf("\n***Coded By:Rajendra Prasad
Joshi***");
return 0;
}

4. // string upper/lower case conversion


#include <stdio.h>
#include <string.h>
int main() {
char str[] = "Hello, World!";
for (int i = 0; i < strlen(str); ++i) {
if (str[i] >= 'a' && str[i] <= 'z') {
str[i] -= 32; // Convert to uppercase
} else if (str[i] >= 'A' && str[i] <= 'Z') {
str[i] += 32; // Convert to lowercase
}
}
printf("Modified string: %s\n", str);
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

output:

7. //WAP
//WAP tothat
count characters
checks whetherinit string
contains a substring: Output:
output:
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>

int main() { {
int main()
char str[20] ;
char str[100];
int count
char= 0;
substring[100];
printf("Enter a string: ");
scanf("%s",&str);
printf("Enter a string: ");
scanf("%s", str);
for (int i = 0; i < strlen(str); ++i) {
if (str[i] != ' ') { a substring to search for: ");
printf("Enter
count++; substring);
scanf("%s",
}
} if (strstr(str, substring) != NULL) {
printf("Number of characters
printf("'%s' in '%s': %d\n",
contains '%s'.\n", str, count);
str, substring);
printf("\n***Coded
} else { By:Rajendra Prasad Joshi***");
return 0;
printf("'%s' does not contain '%s'.\n", str,
} substring); }
printf("\n***Coded By:Rajendra Prasad Joshi***");
return 0;
}

You might also like