INDEX
TABLE OF COnTEnTs
1. Largest Number among three given
2. numbers Whether the number is even or
odd
3. Prime Numbers 1 to n
4. Factorial of a given number
5. Search Element in an array
6. Addition of Two Matrices
7. Generate Fibonacci Series using Function
8. Swap Two Numbers
9. Use of Structure
10. Heading and Paragraphs in HTML
11. Ordered an Unordered List + Hyperlink
12. HTML Forms
13. CSS with HTML
14. Images and Tables
15. Mail Merge
16. DOS Commands
Largest Number among
three given numbers
[A] /*Algorithm*/
Step 1 : Start
Step2 : Input a, b, c
Step3 : if a > b
Step4 : if a > c
Step5 : if b > c
Step6 : Output "a is the largest",
Step7 : Output "b is the largest",
Step8 : Output " c is the largest",
Step9 : Stop
Largest Number among
three given numbers
[B] /*Flowchart*/
Largest Number among
three given numbers
[C] /*Program*/
#include <stdio.h>
int main()
{
int A, B, C;
printf("Enter three numbers: ");
scanf("%d %d %d", &A, &B, &C);
if (A >= B && A >= C)
printf("%d is the largest number.", A);
else if (B >= A && B >= C)
printf("%d is the largest number.", B);
else
printf("%d is the largest number.", C);
return 0;
}
Largest Number among
three given numbers
[D] /*Output*/
Whether the number is
even or odd
[A] /*Algorithm*/
Step 1: START
Step 2: Take integer variable A
Step 3: Assign value to the variable
Step 4: Perform A modulo 2 and check result if
output is 0
Step 5: If true print A is even
Step 6: If false print A is odd
Step 7: Stop
Whether the number is
even or odd
[B]/*Flowchart*/
Whether the number is
even or odd
[C] /*Program*/
#include <stdio.h>
int main()
{
int even = 24;
int odd = 31;
if (even % 2 == 0)
printf("%d is even\n", even);
if (odd % 2 != 0 )
printf("%d is odd\n", odd);
return 0;
}
Whether the number is
even or odd
[D] /*Output*/
Prime Numbers 1 to n
[A] /*Algorithm*/
Step1: START
Step 2: Take integer variable A
Step 3: Divide the variable A with (A-1 to 2)
Step 4: If A is divisible by any value (A-1 to 2) it
is not prime.
Step 5: Else it is prime
Step 6: STOP
Prime Numbers 1 to n
[B] /*Flowchart*/
Prime Numbers 1 to n
[C] /*Program*/
#include <stdio.h>
int main()
{
int loop, number;
int prime = 1;
number = 11;
for(loop = 2; loop < number; loop++) {
if((number % loop) == 0)
{
prime = 0;
}
}
if (prime == 1)
printf("%d is prime number.", number);
else
printf("%d is not a prime number.", number);
return 0;
}
Prime Numbers 1 to n
[D] /*Output*/
Factorial of a given number
[A] /*Algorithm*/
Step 1 :
Start Step 2 :
Read n Step 3 :
Initialize counter variable i to 1 and fact to 1 Step 4 :
If i <= n go to step 5 otherwise goto step 7 Step 5 :
Calculate fact = fact * i Step 6 :
Increment counter variable i and goto step 4 Step 7:
Write fact Step 8 :
Stop
Factorial of a given number
[B] /*Flowchart*/
Factorial of a given number
[C] /*Program*/
#include <stdio.h>
unsignedint factorial(unsigned int n)
{
int res = 1, i;
for (i = 2; i <= n; i++)
res *= i;
return res;
}
int main()
{
intnum = 5;
printf(
"Factorial of %d is %d", num, factorial(num));
return 0;
}
Factorial of a given number
[D] /*Output*/
Search Element in an array
[A] /*Algorithm*/
Step 1 :
Start Step 2:
Read n Step 3:
Initialize counter variable i Step 4 :
Iterate over each element Step 5 :
Search for element at index Step 6 :
Return index and value Step 7 :
Stop
Search Element in an array
[B] /*Flowchart*/
Search Element in an array
[C] /*Program*/
#include<stdio.h>
int main()
{
inti,flag=0,pos,n,a[5];
printf("Enter elements in array \t");
for(i=0;i<=4;i++)
{
printf("\nEnter element number \t",i+1);
scanf("%d",&a[i]);
}
printf("\nEntered 5 arrray elements are:-");
for(i=0;i<=4;i++)
{
printf("\n\ta[%d]=%d\n",i,a[i]);
}
printf("\nEnter the element to be searched in array");
scanf("%d",&n);
for(i=0;i<=4;i++)
{
if(a[i]==n)
{
printf("\nSearch Successful");
printf("\nElement %d is found at %d position",n,i+1);
flag=1;
break;
}
}
if(flag==0)
{
printf("\nElement does not found");
}
return 0;
}
Search Element in an array
[D] /*Output*/
Addition of two matrices
[A] /*Algorithm*/
Step 1 :START
Step 2 :Input matrix 1 and matrix 2.
Step 3 :If the number of rows and number of
columns of matrix 1 and matrix 2 are equal
then execute else addition not possible
Step 4 :for i=1 to rows[matrix 1] for j=1 to
columns [matrix 1] Input matrix 1 [i,j] Input
matrix 2 [i,j]
matrix 3 [i,j]= matrix 1 [i,j] + matrix 2 [i,j];
Step 5 :Display matrix 3 [i,j];
Step 6 :STOP
Addition of two matrices
(C)/* Program*/
Addition of two matrices
(D)/*Output */
#include <stdio.h>
int main() {
int r, c, a[100][100], b[100][100], sum[100][100], i, j;
printf("Enter the number of rows (between 1 and 100): ");
scanf("%d", &r);
printf("Enter the number of columns (between 1 and 100):
");
scanf("%d", &c);
printf("\nEnter elements of 1st matrix:\n");
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
printf("Enter element a%d%d: ", i + 1, j + 1);
scanf("%d", &a[i][j]);
}
printf("Enter elements of 2nd matrix:\n");
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
printf("Enter element a%d%d: ", i + 1, j + 1);
scanf("%d", &b[i][j]);
}
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
sum[i][j] = a[i][j] + b[i][j];
}
// printing the result
printf("\nSum of two matrices: \n");
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
printf("%d ", sum[i][j]);
if (j == c - 1) {
printf("\n\n");
}
}
return 0;
}
Addition of two matrices
[B] /*Flowchart*/
Fibonacci Series
[A]/* Algorithm*/
Step 1 : Start
Step 2 : Declare variables i, a,b , show
Step 3 : Initialize the variables, a=0, b=1, and show =0
Step 4 : Enter the number of terms of Fibonacci series to
be printed
Step 5 : Print First two terms of series
Step 6: Use loop for the following steps show=a+b a=b
b=show increase value of i each time by 1 print the value
of show
Step 7 :End
Generate Fibonacci Series
using Function
[B]/* Flowchart*/
Fibonacci Series
[C]/*Program*/
#include<stdio.h>
int fib(int n)
{
if (n <= 1)
return n;
return fib(n-1) + fib(n-2);
}
int main ()
{
int n = 9;
printf("%d", fib(n));
getchar();
return 0;
}
Fibonacci Series
[D]/*Output*/
Swap Two Numbers
[A]/*Algorithm*/
Step 1 :- START
Step 2 :- Var1, Var2, Temp
Step 3 :-Copy value of Var1 to Temp
Step 4 :-Copy value of Var2 to Var1
Step 5 :-Copy value of Temp to Var2
Step 6 :-STOP
Swap Two Numbers
[B]/*Flowchart*/
Swap Two Numbers
[C]/*Program*/
#include <stdio.h>
// This function swaps values referred by
// x and y,
void swap(int&x, int&y)
{
int temp = x;
x = y;
y = temp;
}
int main()
{
int x, y;
printf("Enter Value of x ");
scanf("%d", &x);
printf("\nEnter Value of y ");
scanf("%d", &y);
swap(x, y);
printf("\nAfter Swapping: x = %d, y = %d", x, y);
return 0;
}
Swap Two Numbers
[D]/*Output*/
Structure in C
/*Program to add two distances (feet-inch)*/
#include <stdio.h>
struct Distance
{ int feet;
float inch;
} dist1, dist2, sum;
int main()
printf("1st distance\n");
printf("Enter feet: ");
scanf("%d", &dist1.feet);
printf("Enter inch: ");
scanf("%f", &dist1.inch);
printf("2nd distance\n");
printf("Enter feet: ");
scanf("%d", &dist2.feet);
printf("Enter inch: ");
scanf("%f", &dist2.inch);
// adding feet
sum.feet = dist1.feet + dist2.feet;
// adding inches
sum.inch = dist1.inch + dist2.inch;
// changing to feet if inch is greater than 12
while (sum.inch>= 12)
{ ++sum.feet;
sum.inch = sum.inch - 12;
printf("Sum of distances = %d\'-%.1f\"", sum.feet, sum.inch);
return 0;
}
/*Program to add two distances
(feet-inch)*/
/*Output*/
Headings and paragraph in HTML
<!DOCTYPE html>
<html>
<body>
<h1 style="font-size:60px;">Heading 1</h1>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
<p>This is some random stuff.</p>
<p>This is<br>a paragraph<br>with line breaks.</p>
<pre>
My Bonnie lies over the ocean.
My Bonnie lies over the sea.
My Bonnie lies over the ocean.
Oh, bring back my Bonnie to me.
</pre>
</body>
</html>
Headings and paragraph in HTML
/*Output*/
Ordered and Uncorded List
with hyperlink
<!DOCTYPE html>
<html>
<body>
<style>
a:link {
color: green;
background-color: transparent; text-decoration: none;
a:visited {
color: pink;
background-color: transparent; text-decoration: none;
a:hover {
color: red;
background-color: transparent; text-decoration: underline;
a:active {
color: yellow;
background-color: transparent; text-decoration: underline;
</style>
<h2>A Description List</h2>
<dl>
<dt><a href="https://www.google.com/">Coffee</a></dt>
<dd>- black hot drink</dd>
<dt><a href="https://www.gfacebook.com/">Milk</a></dt>
<dd>- white cold drink</dd>
</dl>
<h2>An unordered HTML list</h2>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<h2>A Nested List</h2>
<p>Lists can be nested (list inside list):</p>
<ul>
<li><a href="https://www.google.com/">Coffee<a/></li>
<li><a href="https://www.google.com/"><a/>Tea
<ul>
<li><a href="https://www.google.com/">Black tea<a/></li>
<li><a href="https://www.google.com/">Green tea<a/></li>
</ul>
</li>
<li><a href="https://www.google.com/">Milk<a/></li>
</ul>
</body>
</html>
Ordered and Uncorded List
with hyperlink
/*Output*/
Form HTML
<!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="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
<h2>Text input fields</h2>
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe">
</form>
<h2>Radio Buttons</h2>
<form>
<input type="radio" id="male" name="gender" value="male">
<label for="male">Male</label><br>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label><br>
<input type="radio" id="other" name="gender" value="other">
<label for="other">Other</label>
</form>
<h2>Checkboxes</h2>
<form>
<input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
<label for="vehicle1"> I have a bike</label><br>
<input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
<label for="vehicle2"> I have a car</label><br>
<input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
<label for="vehicle3"> I have a boat</label><br><br>
</form>
</body>
</html>
Form HTML
/*Output*/
CSS with HTML
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: lightblue;
}
h1 {
color: white;
text-align: center;
}
p{
font-family: verdana;
font-size: 20px;
}
.p1 {
font-family: "Times New Roman", Times, serif;
}
.p2 {
font-family: Arial, Helvetica, sans-serif;
}
.p3 {
font-family: "Lucida Console", "Courier New", monospace;
}
</style>
</head>
<body>
<h1>My First CSS Example</h1>
<p>This is a paragraph.</p>
<h1 style="background-color:Tomato;">Tomato</h1>
<h1 style="background-color:Orange;">Orange</h1>
<h1 style="background-color:DodgerBlue;">DodgerBlue</h1>
<h1 style="background-color:MediumSeaGreen;">MediumSeaGreen</h1>
<h1 style="background-color:Gray;">Gray</h1>
<h1 style="background-color:SlateBlue;">SlateBlue</h1>
<h1 style="background-color:Violet;">Violet</h1>
<h1 style="background-color:LightGray;">LightGray</h1>
<h1 style="border: 2px solid Tomato;">Hello World</h1>
<h1 style="border: 2px solid DodgerBlue;">Hello World</h1>
<h1 style="border: 2px solid Violet;">Hello World</h1>
<h1>CSS font-family</h1>
<p class="p1">This is a paragraph, shown in the Times New Roman font.</p>
<p class="p2">This is a paragraph, shown in the Arial font.</p>
<p class="p3">This is a paragraph, shown in the Lucida Console font.</p>
</body>
</html>
/*Output*/
Images and Table
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
</style>
</head>
<body>
<h2>Image and Tables </h2>
<center><p>The first image.</p></center>
<imgsrc="html5.gif" alt="HTML5 Icon" width="128" height="128">
<center><p>The second image </p>
<imgsrc="html5.gif" alt="HTML5 Icon" style="width:128px;height:128px;">
</center>
<h2>Table Caption</h2>
<p>To add a caption to a table, use the caption tag.</p>
<table style="width:100%">
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>
</body>
</html>
/*Output*/
First image :-
Second image :-
Mail Merge
Mail Merge is a handy feature that incorporates data from both
Microsoft Word and Microsoft Excelandallows you to create multiple documents at
once, such as letters, saving you the time and effort of retyping the same letter
over and over. Here is an example of how to use it to create a letter thanking people
who donated to a particular fund.
1.)Gathering Your Data
The first thing you do is create an Excelspreadsheet, creating a header for each field such as
First Name, Last Name, Address, City, State, and Postal Code
(NOTE: It’s important to not refer to the postal code as a zipcode, but more about that later).
The field headers(ie first name, lastname)are labeled separatelyso that you can filter them
alphabetically if you need to. You can also add additional headers, such as a donation amount.
Be sure to label it something you’ll remember.
If you are using dollar amounts,change the type of number it is under ‘Number’ at the very top to
‘Text’ for every dollar entry and manually type the dollar sign otherwise the dollar sign ($) will not show
upin your letter.
2.)Prepare your letter in Microsoft Word. When creating a
letter,it’s a good ideato insert a placeholder where the
information from the mail merge will be placed, ie
[Address], [Amount].
3.)Under “Mailings” in Microsoft Word click on ‘Start Mail Merge’
and click on ‘Step by Step Mail Merge Wizard.’
Next, click ‘Select Recipients’ at the bottom. You will see ‘Use an
Existing List’ the ability to browse for your list.
Click on the ‘browse’ button and find your list on your computer
that you typed up in Excel.
Once you find your document click open and a box will show up that says ‘Select table.’ If you only
had one tab on your spreadsheet click okay.
You will then see the data you had typed. You can also choose to
leave off certain names if you want to. Click okay.
The table will close and then the dialog box on the right will say
‘Currently Your Recipients Are Selected From:’ and will give the
title of your excel spreadsheet document.
At the bottom of the dialog box click ‘write your letter.’
From there you can start adding your fields from your spreadsheet.
Highlight the placeholder marked [Address] and then click on
Address block. The spreadsheet will pull in your data from your
spreadsheet.
If you did not write ‘postal code’ and wrote ‘zip code’ instead you can click on ‘match fields’and find
the field that matches ‘postal code’ instead. Be sure to cycle through your address list to make sure
your addresses are correct. Click okay.
Highlight the greeting line placeholder and replace it with the ‘Greeting Line’ under Write Your Letter.
You can also filter it to where it only lists their first name.
For the other fields such as ‘amount’ you can highlight amount and go to ‘More items.’ Then, go down to ‘amount’ and se
Next go to ‘preview your letters.’ From there the database information
will have populated your letter. You should be able to cycle through the
information you typed to make sure that your addresses and amounts
are correct.
If you’re satisfied, click on ‘Complete the
merge’ and then click on ‘print.’
It will give you the option to click on ‘print current record’ or you can print all
of the letters from your database.
It’s important to thoroughly look over all your letters to make sure there aren’t any typos or
problems with formatting, especially on the letter itself.
You can use the mail merge to create letters, mailing labels, emails, name badges, or etc. This can also
work on saving it to a PDF if you’ve got a PDF converter, such as Primo PDF.
MS-DOS
MS-DOS is a text-based system of Microsoft Operating System , The users interact with the
computer by typing text-based commands rather than a Graphical User Interface. These
commands allow users to perform various tasks, such as copying, deleting, or moving files,
and managing programs.
USES
•File Management: MS-Dos commands enable users to navigate through directories and
create, delete, or copy files, enabling efficient file management.
•System Configuration: Users can configure system settings, manage drives, and analyze
hardware issues using MS Dos commands, providing a robust toolkit for system
customization.
•Program Execution: MS-Dos for commands facilitate the execution of programs and scripts,
offering a streamlined approach to launching applications without the need for graphical
interfaces.
List of MS-Dos Commands:
Here’s a table of some of the essential and commonly used commands MS-Dos for
Commands for quick reference:
Command Description
CD ges the current directory to the specified folder.
DIR Displays a list of files and subdirectories in a
COPY directory. Copies files from one location to
DEL another.
REN Deletes one or more files.
MKDIR Renames a file or directory.
RMDIR Creates a new directory.
Removes an existing directory.
Description
Command
filename Displays the contents of a text file.
TYPE
Opens the MS-DOS text editor for editing a specified file.
EDIT
Scans and fixes errors on a disk.
CHKDSK
FORMAT Prepares a storage medium for data storage.
XCOPY Copies files and directories, including subdirectories.
TREE Graphically displays the folder structure of a drive or path.
DATE Displays or sets the system date.
TIME Displays or sets the system time.
HELP Provides help information for MS-DOS commands.
EXIT Exits the MS-DOS command prompt or a batch file.
Sets or clears file attributes (Read-Only, Archive, System, Hidden),
managing file visibility and access in MS-DOS.
ATTRIB Configures system devices.
MODE Copies the contents of one disk to another.
DISKCOPY Displays the amount of used and free memory in the system.
MEM Scans and fixes disk errors.
SCANDISK
Command Description
UNDELETE Restores a deleted file.
ASSIGN Redirects requests for drive letters to a different drive.
FDISK Manages disk partitions.
BACKUP Backs up files and directories.
RESTORE Restores files and directories from a backup.
MSCDEX Provides CD-ROM access.
SYS Transfers system files to a disk.
SHARE Installs file-sharing and locking capabilities.
SMARTDRV Disk caching utility.
SETVER Sets the MS-DOS version number for a program.
ASSIGN Disables automatic drive-letter assignments.
FASTHELP Provides a quick overview of MS-DOS commands.
FC Compares two files or sets of files and displays the differences
FIND between them. Searches for a text string in files.
MORE Display the content of a text file one screen at a time
ECHO This command can either show or hide the text of the commands you
type.
Command echoing is on by default
Command Description
ECHO Specifies the text to display on the screen.
PATH Displays or sets a search path for executable files.
SET Sets or displays environment variables.
VOL Displays a disk label and serial number.
SUBST Associates a path with a drive letter.
EDLIN Edits text files.
DEBUG Starts the Debug program for testing and debugging assembly-language
programs.
HIMEM.SYS Provides upper memory block (UMB) and high memory area (HMA)
support.
UNFORMAT Restores a formatted disk.
GRAPHICS Enables output of graphical screen content to print
QBASIC Starts the MS-DOS-based application for creating and running BASIC
programs.
KEYB Configures a keyboard for a specific language.
CHOICE Provides a prompt with a list of choices.
DISKCOMP Compares the contents of two floppy disks.
PRINT Sends a text file to a printer.
SORT Sorts the contents of a text file.
Command Description
APPEND Sets or displays the search path for data files.
ASSOC Associates file extension with a file type.
LABEL Creates, changes, or deletes the volume label of a disk.
RECOVER Recovers readable information from a bad or defective disk.
FASTOPEN Speeds up the opening of files.
SHIFT Shifts the position of batch parameters in a batch file.
JOIN Joins a drive letter and directory path.
SMARTDRV Manages and optimizes disk caching.
BATCH Executes the commands specified in a batch file.
CALL Calls one batch program from another.