Sei sulla pagina 1di 96

MS-WORD

SEARCH, GENERATE, AND MANIPULATE DATA USING MS


OFFICE / OPEN OFFICE
Ex No: 1(a)
Date :

RESUME PREPARATION

AIM
To prepare a resume using Microsoft Office Word.
ALGORITHM
Step 1: Start the Application
Step 2: Open the New Document (ctrl key + n).
Step 3: Enter the details of name, qualification, address, Hobbies etc.
Step 4: Align the document by using the alignment tools.
Step 5: Set the proper font size, Spacing, Line width etc.
Step 6: Save the document FILE
SAVE (ctrl key + s) and press OK. While saving select
the particular place like desktop or local disk C:
Step 7: Close the Application.

OUTPUT
CURICULUM VITAE
Name: XXXXXXX
PH: 0000000000000
Email-id: XXXXXXX@rediffmail.com ZZZZZZZZZ YYYYYYY RRRRRRRR

Career Objective
Aspiring to build a leading corporate of I-tech environment with committed
and dedicated people which will help me to explore myself fully and realize my potential
Educational Profile
th
12 Standard, first class with 80% from St. Peters school Kodaikanal in the
period of 2008-2009
th
10 Standard, first class with 95% from Bhavans Vidyashram School
Kodaikanal in the period of 2006-2007
Strength
Ability to give qualitative output with presenting and cope up with the workload
Ability to work under pressure, stress, and meet deadlines
Ability to work in a team with high level of involvement
Skill Set
Languages
RDBMS
.Net Technologies
Platforms
Others
Personal Details
Name

XXXXXXX

Fathers Name

EEEEEEEE

Date of Birth

18-08-1992

Marital Status

Unmarried

Languages Known

English, Tamil, Malayalam

: Visual Basic, Java


: Oracle, MS Access, Sql Server 2005
: Asp.Net, vb.Net
: Windows 9.x, XP, Vista, Linux, Solaris
: HTML (Dreamweaver), Basic JavaScript, Flash

Declaration
I hereby declare that the above particulars given by me are true to the best of my
knowledge.
XXXXXXX

RESULT
Thus the resume has been prepared using Microsoft Office Word and the output was
verified successfully.
3

Ex No: 1(b)
Date :

TIME TABLE PREPARATION

AIM
To prepare the time table using Microsoft Office Word.
ALGORITHM
Step 1: Start the Application
Step 2: Open the New Document.
Step 3: Click on the TABLE
INSERT
TABLE.
Step 4: Now the insert table dialog box is opened.
Step 5: Choose number of columns and rows.
Step 6: Auto format the table if necessary.
Step 7: Click OK.
Step 8: Enter the datas in the appropriate boxes, by right click and then ADDTEXT.
Step 9: Align the table, set the font size etc..
Step 10: Save the document FILE
SAVE and press OK.
Step 11: Close the Application.

OUTPUT

TIME TABLE

II

III

IV

Mon

Eng

Che

Phy

F.O.C

Tue

F.O.C

Mat

Mat

Eng

Wed

Phy

Thu

Mat

Fri

Che

Mat

Eng

Phy

Sat

Phy

Eng

Mat

Che

Engg. Graphics
Phy/Che Lab

V
BREAKLUNCH

INTERVAL

DAY

VI

VII

Engg. Graphics
C.P. Lab
F.O.C

Che

Mat

Che

Phy

F.O.C

Engg. Practice Lab


F.O.C

Che

Phy

RESULT
Thus the time table was prepared by using Microsoft Office Word and output was
verified.
5

Ex No: 1(c)
Date :

TABLE CONVERSION

AIM
To convert Text to Table by using Microsoft Office Word.
ALGORITHM
Step 1: Start the Application
Step 2: Open the New Document.
Step 3: Select the text, which we want to put in a table.
Step 4: Then, choose Table
convert Text to Table option.
Step 5: Now the Convert Text to Table dialog box appears.
Step 6: Specify the Number of Columns and Separate text at option as Tabs, then click Ok to
convert the tabular text to a table.
Step 7: Gridlines are displayed to show the boundaries between rows and columns.
Step 8: Drag the columns width with the mouse to read just the column widths visually.
Step 9: Note that the column separator is a tab. We must be consistent in the way that we use
tabs.
Step 10: Save the document FILE
SAVE and press OK.
Step 11: Close the Application.

OUTPUT
S.No, Subject code, Subject, Name of Faculty
1., ENG, Technical English-1, Dr. G. Shanmugasundaram
2., MAT, Mathematics-1, Mrs. N. Manonmani
3., PHY, Engineering Physics-1, Mr. K. Senthilkumar
4., CHE, Engineering Chemistry-1, Mrs. G. Latha
5., FOC, Fundamentals of Computing and Programming, Mr. R. Lenin Babu
S.No

Subject code

Subject

Name of Faculty

1.

ENG

Technical English-1

Dr. G. Shanmugasundaram

2.

MAT

Mathematics-1

Mrs. N. Manonmani

3.

PHY

Engineering Physics-1

Mr. K. Senthilkumar

4.

CHE

Mrs. G. Latha

5.

FOC

Engineering Chemistry-1
Fundamentals of
Computing and
Programming

Mr. R. Lenin Babu

RESULT
Thus the Text was converted to a Table using Microsoft Office Word and the output
was verified.

Ex No: 1(d)
Date:

ADVERTISEMENT

Design the advertisement for our college in Microsoft word file by applying all styles like
bold, italic, underlines, colour fonts, bulletins, word art, and tables, line spacing.
AIM:
To design the advertisement for a college in MS-WORD file by applying MS-WORD
tools.
ALGORITHM:
Step 1: Start the application
Step 2: Open the new document.
Step 3: Type the details for the advertisement.
Step 4: Choose HOME
FONT to make the word or sentence bold, italic, underscore,
color fonts.
Step 5: Choose HOME PARAGRAPH to apply bulletins and line spacing.
Step 6: Select INSERT TABLE to draw
Step 7: Go to INSERT
TEXT to apply word art to a word.
Step 8: Save the document.

OUTPUT:

BENIFITS:

DEPARTMENTS:

100 % placement.

UG COURSES
Excellent Infrastructure
S.NO
1
2

Department
CSE
ECE

Hard work leads to success.

RESULT:
Thus the Advertisement of a college is designed successfully with given tools using
MS-WORD.
9

Ex No: 1(e)
Date :

MAIL MERGE PRESENTATIONS

AIM
To produce multiple mails using mail merge wizard in Microsoft Office Word
ALGORITHM
Step 1: Start the Application
Step 2: Open the New Document.
Step 3: Open an existing letter or creating a new letter
Step 4: On the tools menu click mail merge
Step 5: Click the option to create for a new document
Step 6: Create a new Data Source
Step 7: Under mail merge dialog box, data source click Data Source and then click Ger Data,
then click Data Source
Step 8: Insert the headers and then data
Step 9: To add new record clicks add new
Step 10: Inserting merge fields
Step 11: Insert the merge fields where we want to merge names, addresses and other data
Step 12: Click insert image field on the mail merge tool bar and then specify the fields
Step 13: Click inserts all. Save the multiple copies of document
Step 14: Close the Application

10

OUTPUT
From
XXXXXXXX
YYYYYYYY
ZZZZZZZZZ
To
First_Name
Collage_Name
Address_Line_1
City
State
Country

Respected Sir,
Subject: Regarding Admission to your collage
Iam XXXXXXX. I had finished my school Studies this year and also I scored good
marks in all subjects. Now I am willing to study in your collage. So I request you to send me
an application form.
Thanking You,
Date: 09-10-2012,
Coimbatore.

Yours Faithfully,
XXXXXXXX

11

From
XXXXXXXX
YYYYYYYY
ZZZZZZZZZ
To
The Principal,
Hindusthan,
Otakal Mandapam,
Coimbatore, Tamil
Nadu, India.
Respected Sir,
Subject: Regarding Admission to your collage
I am XXXXXXX. I had finished my school Studies this year and also I scored good
marks in all subjects. Now i am willing to study in your collage. So I request you to send
me an application form.
Thanking You,
Date: 09-10-2012,
Coimbatore.

Yours Faithfully,
XXXXXXXX.

From
XXXXXXXX
YYYYYYYY
ZZZZZZZZZ
To
The Principal,
Sri Krishna,
Kovai Puthur,
Coimbatore,
Tamil Nadu,
India.
Respected Sir,
Subject: Regarding Admission to your collage
I amXXXXXXX. I had finished my school Studies this year and also I scored good
marks in all subjects. Now i am willing to study in your collage. So I request you to send
me an application form.
Thanking You,
Date: 09-10-2012,
Coimbatore.

Yours Faithfully,
XXXXXXXX

RESULT
Thus the multiple mails were produced using mail merge wizard and the output
was verified.
12

Ex. No: 1(f)


Date:

PARAGRAPH EDITING

In the pwer tool aisle, pick up a cordless drill or saw from DeWalt and there might well be a futuristic
battery pack attacheda battery that promises greater power, longer life, better safety, and shorter
recharge time than conventional llithiun ion- batteries.
The batery itself looks little diferent to the naked eye, or even under a microscope. The key to the
battery's performance is in the diameter of the lithium particles that hold and release electric charge.
The so-called nanophosphate lithium-ion batteries.
Questions
1. Indent the second paragraph by 1cm on the left
2. Insert the first paragraph into a textbox
3. Put a border around the whole document
4. Format the document with 1.5 Line Spacing
5. Change the font for the whole document to Broadway and font size 10
6. Justify all the text
7. Change the sentence The battery a microscope to Title Case
8. Put your name and student number into a table at the top of the document
9. Insert the Date into the Header using Date/Time Function
10. Remove the text conventional lithium-ion batteries
11. Insert page numbers to your document at the top and center
12. Place the 2nd paragraph into 2 columns
13. Type the heading Power Points at the top of the Document and make it
Underline, Bold and centre
14. Fix any spelling mistakes that occur in the document. Make sure the
Language is set to English (South Africa).

AIM:
To modify the given content using Microsoft word.
ALGORITHM:

Step 1: Start the application


Step 2: Open a new document.
Step 3: Choose PAGE LAYOUT INDENT (or double click the in the ruler) to apply
indent.
Step 4: Select INSERT TEXTBOX to add your content in the text box.
Step 5: To put border in the document use the path PAGE LAYOUT
PAGE
BACKGROUND
PAGE BORDERS.
Step 6: Apply the line spacing and given font specifications in the paragraph.
Step 7: To justify use HOME
PARAGRAPHJUSTIFY.
Step 8: Title case (capitalise) the given words by HOMEFONT CHANGE CASE (ctrl
key+ shift key + a).
Step 9: Create a table INSERTTABLE and select the rows and columns you need.
Step 10: Delete required sentence or word by select it and RIGHTCLICK CUT (or)
HOME
CLIPBOARD CUT (ctrl+x)
Step 11: Go to INSERT PAGENUMBER to insert page numbers in your document.
Step 12: Pick PAGELAYOUT
PAGESETUP
COLUMN to change the column
setup.
Step 13: Prefer REVIEWPROOFINGSPELLING & SET LANGUAGE to set the
language and corrections in the paragraph.
Step 14: Save the document
13

OUTPUT:
POWER POINTS

ROLL.NO NAME
001

xyxy

performance is in the diameter of the


THE BATTERY itself looks little diferent
to the naked eye, or even under A

lithium

particles

that

hold

and

MICROSCOPE. The key to the battery's

nanophosphate lithium-ion batteries.

release electric charge. The so-called

In the power tool aisle, pick up a cordless drill or saw from DeWalt and there
might well be a futuristic battery pack attacheda battery that promises
greater power, longer life, better safety, and shorter recharge time than.

RESULT:
Thus the given paragraph is changed with given specifications using MS-WORD.
14

Ex. No: 1(g)


Date:

VISITING CARD PREPARATION

Create a visiting card for you as per the following specifications using MS-WORD. Size of
visiting card is 42 office and Residential address separated by a line and insert logo.

AIM:
To create a visiting card using MS-WORD.
ALGORITHM:
Step 1: Open a new document.
Step 2: Go to PAGE LAYOUT
PAGESETUP SIZE
MORE PAGE SIZES.
Step 3: Change the sizes of the paper width to 4 and height to 2, also change the
margins bottom and right to 0.15.
Step 4: Type the office and Residential address in the Visiting card and separate the address
by a line using borders.
Step 5: Use clip arts, shapes if necessary.
Step 6: Do the required changes in your visiting card and save the document.

15

OUTPUT:

RESULT:
Thus a Visiting card is designed as per the specification given with the help of
MS-WORD.
16

MS-EXCEL

17

PRESENTATION AND VISUALIZATION GRAPHS, CHARTS, 2D, 3D


Ex No: 2(a)
Date :

MARK SHEET PREPARATION USING MS-EXCEL

AIM
To create students mark sheet using Microsoft Office Excel and to create a chart
ALGORITHM
Step 1: Start the Application
Step 2: Open the New Excel Document
Step 3: Enter the field name in cells
Step 4: Enter the required data for preparing the mark sheet
Step 5: From the functions menu choose the function to calculate the total marks of each
student
Step 6: Calculate the average mark pf of each student using the formula
Step 7: Type the formula in the formula bar to logically check the students mark to calculate
the grade of the student
Step 8: To print the Chart
a. Select the data that are to be entered in the chart
b. In the Insert menu click Chart Wizard and specify the details in the chart
Step 9: Save the document FILE
SAVE and press OK
Step 10: Close the Application

18

OUTPUT

Name

Physics

Chemistry Maths

Total

Average

Grade

Arun

80

56

91

227

75.6

Bala

70

72

85

227

75.6

Chandran

62

80

79

221

73.6

Student Mark details


76
75.5

Average

75
74.5
Avg
74
73.5
73
72.5
Arun

bala

Chandran

RESULT
Thus the student mark sheet and the chart was created using Microsoft Office
Excel and the output was displayed.
19

Ex No. 2(b)
Date:

SALARY DETAILS

The following Salaries of 5 employees


Employee no

Employee
Name

Basic Salary
(Rs)

Prasanna

10000

1012

Anitha

14000

1013

Ravi

18000

1014

Saritha

15000

1015

Mallika

17000

1011

a.
b.
c.
d.

Calculate DA @ 20%, HRA @ 15%, CCA fixed Rs.200, PF @ 10%


Calculate Gross salary & Net Salary
Insert a picture.based on the given table.
Using Conditional Formatting list out employees in MS- EXCEL who got
i. Less than Rs. 15000 as salary
ii. Between Rs. 15000 and Rs. 20000 as Net Salary.

AIM
To calculate salary of the employees and to use conditional formatting in the
Microsoft Office Excel worksheet
ALGORITHM
Step 1: Start the Application
Step 2: Open the New Excel Document
Step 3: Insert the values as per the given table
Step 4: Calculate DA, HRA as per the following formula DA= (Basic Salary * DA %) / 100
HRA= (Basic Salary * HRA %) / 100 PF= (Basic Salary * PF %) / 100
Step 5: Calculate Gross salary & Net salary by using the formulas Gross Salary= (Basic
salary + DA + HRA+CCA) Net Salary= (Gross salary PF)
Step 6: Then choose conditional formatting form HOME
MENU
Step 7: Now choose HIGHLIGHT CELLS
LESS THAN, a dialog box opens.
Step 8: Enter the value in dialog box. Then click ok button.
Step 9: similarly select the cells for greater than and between values.
Step 10: Now the selected picture is inserted into the worksheet.
Step 11: Save the document FILE
SAVE and press OK
Step 12: Close the Application

20

OUTPUT

RESULT
Thus the calculation of salary details, conditional formatting and picture insertion was
successfully executed in the Microsoft Office Excel work sheet and the output was verified.
21

Ex. No: 2(c)


Date:

FORMULAS IN MS-EXCEL

The heights of group of an 11 persons are 123, 134, 145, 167, 178, 167, 168, 149, 156,
179, 180, and 175 centimetres. Enter imaginary names for the heights given and arrange
the names in descending order.
a. Insert One person with height 189
b. Calculate average, maximum, minimum of heights.
c. Change column width of person name as 40.
d. Change row height of average, maximum, minimum to 20.
AIM:
To calculate average, maximum and minimum heights of various students
ALGORITHM:
Step 1: start the application
Step 2: open a new Excel document.
Step 3: enter the persons height. RIGHT CLICK on the COLUMN go to INSERT.
Step 4: Enter the person name in the newly inserted column.
Step 5: Right click on the row go to INSERT. Now insert a new row.
Step 6: calculate average, maximum, minimum by using the following formula Average =
average(num1,num2..)
maximum = maximum(num1,num2..)
minimum = minimum(num1,num2..)
Step 7: Now right click on person name go to COLUMN WIDTH change as 40
Step 8: Now right click on avg., max., min go to ROW HEIGHT change as 20
Step 9: Close the Application

22

OUTPUT:

RESULT
Thus the given values are entered and the average, maximum, minimum heights are
calculated successfully and the output was verified.
23

Ex.No:2(d) NUMBER SYSTEM CONVERSIONS Date:


Generate an excel sheet for the conversion of the following using functions:
a) Decimal to binary
b) Octal to binary
c) Binary to decimal
d) Decimal to hexadecimal
e) Rupees to dollar
AIM:
To create an Excel sheet for the given conversions.
ALGORITHM:
Step 1: Start the application
Step 2: open a new Excel document.
Step 3: Enter the required number
Step 4: Go to FORMULAS
MORE FUNCTIONS
required conversion functions.
Step 5: Save and close the application.

ENGINEERING

use the

24

OUTPUT:

RESULT
Thus the given conversions are calculated successfully and the output was verified.
25

MS-POWER POINT
PERSENTATION

26

Ex No: 2(e)
Date:

POWER POINT PRESENTATION

AIM:
To create a power point presentation using Microsoft office power point
ALGORITHM:
Step 1: Start the application
Step 2: open a new power point document.
Step 3: Enter the required information
Step 4: Apply design and animation for each slide
Step 5: Save and close the application.

27

OUTPUT:

DATA TYPE

PRIMARY DATA TYPE


Primary data types are
Integer data type: int
Character data type: char

Definition
Classification

Single-precision floating point data


type: float
Double-precision floating point data
type: double

DERIVED DATA TYPE

DEFINITION
Data type represents the type of
values which can be processed
by the programming language.

The derived data types are


Arrays
Structures
Unions
Pointers

CLASSIFICATION

Data type

Primary data type

Derived data type

User defined
data type

RESULT
Thus the MS-Power Point Presentation was successfully executed and the output was
verified.
28

PROBLEM FORMULATION, PROBLEM SOLVING AND


FLOWCHARTS
Ex No: 3(a)
Date :

FLOW CHART DRAWING

AIM
To draw a flowchart to find the greatest of three numbers using Microsoft Office Word
ALGORITHM
Step 1: Start the Application
Step 2: Open the New Document
Step 3: Open the New Document
Step 4: Draw the require flow chart symbols from the option Auto shapes
Step 5: Connect all the symbols using arrows
Step 6: Enter the text inside the flow chart symbols
Step 7: Save the document FILE
SAVE and press OK
Step 8: Close the Application

Flowchart

29

OUTPUT

Start

Read a, b, c

False

True
If
a>b

True

False

False

If
b>c

B is Largest

True

If
a>c

C is Largest

A is Largest

Stop

RESULT
Thus a flowchart to find the greatest of the three numbers was drawn using Microsoft
Office Word and the output was verified.
30

Ex. No: 3(b)


Date :

SCIENTIFIC NOTATIONS

AIM
To type the following equations using Microsoft Office Word
a) Ca(HCO3)2
2
2
b) (A+B) = A
c)
1

+ B

=+

4
4
d) (a + b)
= a
e)
CnH(2n + 1)OH (n 1)
2

CaCo3 + Co2 + H2O


+ 2 AB

f)

2 2

+ 4a b + 6a b

+ 4ab

+ b

=
==

==

ALGORITHM
Step 1: Start the Application
Step 2: Open the New Document.
Step 3: Enter the Equation in document using INSERT
SYMBOLS
EQUATION
INSERT NEW EQUATION.
Step 4: Select the symbols, which we want to show as a subscript.
Step 5: For subscript, choose the Font option from the Format menu, the enable and
subscript check box from the Font dialog box.
Step 6: For superscript, choose the Font option from the Format menu, then enable
the superscript check box from the Font dialog box.
Step 7: Save the document FILE
SAVE and press OK.
Step 8: Close the Application.

31

OUTPUT
Ca(HCO3)2
(A+B)

CaCO3

= A

+ B

+ CO2 + H2O

+ 2 AB
=+

(a + b)

= a

2 2

+ 4a b + 6a b

+ 4ab

+ b

CnH(2n + 1)OH (n 1)
,
= =

,
==

RESULT
Thus the given equations were typed using Microsoft Office Word and the output was
verified.
32

C Programs

33

C PROGRAMMING USING SIMPLE STATEMENTS AND


EXPRESSIONS
Ex No: 4(a)
Date :

LARGEST OF THREE NUMBERS

AIM
To create a C program to find the largest of three numbers
ALGORITHM
Step 1: Start the process.
Step 2: Get the values of a, b, c.
Step 3: Compare A & B. IF A is greater than B perform step 4 else perform step 5.
Step 4: Compare A & C. IF A is greater, Output A is largest.
Perform step 6.
Step 5: Compare B & C. IF B is greater, output B is largest else output C is largest
Step 6: Stop the process.

FLOWCHART

Start

Read a, b, c

False

True
If
a>b

True

False

False

If
b>c

B is Largest

True
If
a>c

C is Largest

A is Largest

Stop
34

PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("\nEnter the three numbers\n");
scanf("%d%d%d",&a,&b,&c); if(a>b)
{
if(a>c)
printf("%d is largest",a);
}
else
{
if(b>c)
printf("%d is largest",b);
else
printf("%d is largest",c);
}
getch();
}

35

OUTPUT

Enter the three numbers


857
8 is largest

RESULT
Thus the c program to find the largest of three numbers has been successfully
completed and the output was verified.

36

Ex No: 4(b)
Date :

EXPRESSION EVALUATION

AIM
To calculate arithmetic operations using C program
ALGORITHM
Step 1: Start the process.
Step 2: Input the variable a, b, c.
Step 3: Enter the value of the operator.
Step 4: Enter the value of the variable a and b.
Step 5: Enter switch operator.
Step 6: Calculate the arithmetic operation based on the operator.
Step 7: Save and execute the program.
Step 8: Display the result.
Step 9: Stop the process.

37

FLOWCHART

Start

Read a, b, op

Enter value for op

Op=Case 1

true

C=a+b

false
Op=Case 2

true

C=a-b

false
Op=Case 3

true

C=a*b

false

true
Op=Case 4

false

C=a/b

true
Op=Case 5

false

C=a%b

Invalid result

Print c

Stop

38

PROGRAM

#include<stdio.h>
#include<conio.h>
void main()
{

char a,b,c,d;
clrscr();
printf("Enter the values of a and
b:"); scanf("%d%d" ,&a,&b);
printf(" Enter your choice between 1 to 5 /n");
scanf("%d , &d);
switch(d)
{
case 1:
c=a+b;

printf(" Addition=%d", c);


break;
case 2:
c=a-b;

printf(" Substraction=%d" , c);


break;
case 3:
c=a*b;

printf(" Multiplication=%d",
c); break;
case 4:
c=a/b;

printf(" Divide=%d",
c); break;
case 5:
c=a%b;
printf(" Remainder=%d",c
); break:
default:
printf(" Invalid
Result"); break;
}
}

39

OUTPUT:
Enter value of a & b:
34
Enter choice between 1 & 5:
1
Addition : 7

RESULT
Thus the c program to calculate the arithmetic operation using switch case has been
successfully completed and the output was verified.

40

SCIENTIFIC PROBLEM SOLVING USING DECISION MAKING AND LOOPING.


Ex No: 5(a)
Date :

REVERSE THE GIVEN NUMBER

AIM
To reverse the given number using C program
ALGORITHM
Step 1: Start the process.
Step 2: Declare the variables n and digit.
Step 3: Initialize the value 0 to rev (i.e rev=0)
Step 4: Get the value of n to reverse
Step 5: Calculate n MOD 10 to split the last value and equate to digit.
Step 6: Multiply rev by 10 and add the value to digit. Equate the value to rev.
Step 7: Divide n by 10 and equate to n.
Step 8: Repeat step 6 to 8 until n is equal to 0
Step 9: if the condition fails, print sum.
Step 10: Stop the process
FLOWCHART
Start

Read n

rev=0

digit=n%10
rev=(rev*10)+digit
n=n/10

While

No

(n!=0)

Yes
Print sum

41
Stop

PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int n,digit,rev=0;
clrscr();
printf("\nenter the number to be
reverse\n"); scanf("%d",&n);
do
{
digit=n%10;
rev=(rev*10)+digit;
n=n/10;
}
while(n!=0);
printf("\nreverse of number is %d",rev);
getch();
}

42

OUTPUT

Enter the number to be reverse


123
Reverse of number:
321

RESULT
Thus the c program to reverse the given number has been successfully completed and
the output was verified.
43

Ex No: 5(b)
Date :

GIVEN NUMBER IS PRIME OR NOT

AIM
To check whether the given number is prime or not by using C program
ALGORITHM
Step 1: Start the process.
Step 2: Get the value for num.
Step 3: Initialize count to 0 and i to 2
Step 4: Check i is less than equal to num divide by 2 and repeat step 5 until the condition fails
Step 5: If step 4 is true, then check num modulo i is equal to zero
Step 6: If step 5 condition is true, then increment the value of count
Step 7: If step 4 fails, go to step 5.
Step 8: stop.
`

44

FLOWCHART

Start

Read num

i=2

No
If (i <=num-1)
Yes
No

If (num%i==0)
yes
Not a prime no.

i++

No
A

If (i==num)

yes

No. is a prime

Stop

45

PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int num,i;
clrscr();
printf("\n enter the number\n");
scanf("%d",&num);
for(i=2;i<=num-1;i++)
{
if(num%i==0)
{
printf("\n given no. is not prime number");
break;
}
}
if(i==num)
{
printf("\n given no. is prime no.");
}
getch();
}

46

OUTPUT

Enter the
number 3
Prime number
Enter the
number 5
Not a prime

RESULT
Thus the c program to find the given number is prime or not has been successfully
completed and the output was verified.
47

Ex No: 5(c)
Date:

ROOTS OF QUADRATIC EQUATION

AIM
To write c program to calculate the roots of the given quadratic equation.
ALGORITHM
Step 1: Start
Step 2: Declare variables a, b, c, D, x1, x2, rp and ip;
Step 3: Calculate discriminant
Db2-4ac
Step 4: If D>0
r1(-b+sqrt(D))/2a
r2(-b-sqrt(D))/2a
Step 5: print the roots are real and unequal.
Display r1 and r2 as roots.
Step 6:
Elseif D==0

R1 r2 b/2a

Step 7: print the roots are real and equal.


Display r1 and r2 as roots.
Step 8: else print roots are imaginary.
Step 9: Stop

48

FLOWCHART:

start

Read a,b,c,D,r1,r2

D=b*b-4*a*c

true
Is D>0

r1= (-b+sqrt(D))/(2*a);
r2= (-b-sqrt(D))/(2*a);

false
true
Is D==0

r1 = r2 = -b/(2*a);

false
Print r1 & r2

Print roots
are imaginary

stop

49

PROGRAM
#include <stdio.h>
#include <math.h>
int main()
{
float a, b, c, D, r1,r2;
printf("Enter coefficients a, b and c:
"); scanf("%f%f%f",&a,&b,&c);
D=b*b-4*a*c;
if (D>0)
{
r1= (-b+sqrt(D))/(2*a);
r2= (-b-sqrt(D))/(2*a);
printf("Roots are: %f and %f",r1 , r2);
}
else if (D==0)
{
r1 = r2 = -b/(2*a);
printf("Roots are: %f and %f", r1, r2);
}
else
{
printf("Roots are imaginary);
}
return 0;
}

50

OUTPUT:
Enter coefficients a, b and c:
410
Roots are: 0.00 and -0.25

RESULT:
Thus the c program to find the roots of the quadratic equation was executed and
the output was verified.

51

Ex No: 5(d)
Date :

CONVERSION OF OCTAL TO DECIMAL

AIM
To convert the given number from octal to decimal using C program
ALGORITHM
Step 1: Start the process.
Step 2: Assign values to the required variables n, i=0.
Step 3: Enter the octal number to be converting.
Step 4: Convert the given number from octal to decimal.
Step 5: Save and execute the program.
Step 6: Display the result.
Step 7: Stop the process.
FLOWCHART
Start

I=0
Sum=0

Get n

False
While(i<n)
True
d=n%10
sum=sum+d*pow(8,i)
n=n/10
i=i+1

Print sum

Stop

52

PROGRAM

#include<stdio.h>
#include<math.h>
#include<conio.h>
void main()
{
int n,i=0,sum=0,d;
clrscr();
printf("\nenter the octal
number\n"); scanf("%d",&n);
while(n>0)
{
d=n%10;
sum=sum+d*pow(8,i);
n=n/10;
i=i+1;
}
printf("\ndecimal equivalent is
%d",sum); getch();
}

53

OUTPUT

Enter the octal number


10
Decimal equivalent is
8

RESULT
Thus the c program to convert the given octal number to decimal has been successfully
completed and the output was verified.

54

SIMPLE PROGRAMMING FOR ONE DIMENSIONAL AND TWO DIMENSIONAL


ARRAYS.
Ex No: 6(a)
Date :

SORTING THE ARRAY ELEMENTS

AIM:
To sort the array of elements in ascending order.
ALGORITHM:
Step 1: Start the process.
Step 2: Read the values of an array.
Step 3: Compare the first element of an array with other elements.
Step 4: If the first element is greater the next, then interchange the elements.
Step 5: Continue the process until the elements are arranged in ascending order.
Step 6: Stop the process.

55

PROGRAM:

#include <stdio.h>
void main()
{
int i, j, a, n, number[30];
printf("Enter the value of N
\n"); scanf("%d", &n);
printf("Enter the numbers
\n"); for (i = 0; i < n; ++i)
{
scanf("%d", &number[i]);
}
for (i = 0; i < n; ++i)
{
for (j = i + 1; j < n; ++j)
{
if (number[i] > number[j])
{
a = number[i];
number[i] = number[j];
number[j] = a;
}
}
}
printf("The numbers arranged in ascending order are given below
\n"); for (i = 0; i < n; ++i)
{
printf("%d\n", number[i]);
}
}

56

OUTPUT:
Enter the value of
N5
Enter the numbers
23 45 6 34 1

The numbers arranged in ascending order are given


below 1 6 23 34 45

RESULT:
Thus the program to arrange the numbers in ascending order using array was
executed successfully and the output was verified.

57

Ex No: 6(b)
Date :

MATRIX MULTIPLICATION

AIM
To perform the matrix multiplication using array concept in C program
ALGORITHM
Step 1: Start the process.
Step 2: Enter the rows and columns for matrix a[i][j] and matrix b[i][j].
Step 3: Enter the elements for matrix a[i][j] and b[i][j].
Step 4: Assign elements of the matrix c[i][j]=0.
Step 5: Multiply the matrix a and matrix b and then store it matrix c
Step 6: Save and execute the program.
Step 7: Display the result.
Step 8: Stop the process.

58

PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int r1,r2,c1,c2,i,j,k,a[10][10],b[10][10],c[10][10]=0;
clrscr();
printf("\nenter the rows and columns of matrix1\n");
scanf("%d%d",&r1,&c1);
printf("\nenter the rows and columns of matrix2\n");
scanf("%d%d",&r2,&c2);
printf("\nenter the elements of
matrix1\n"); for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("\nenter the elements of
matrix2\n"); for(i=0;i<r2;i++)
{
for(j=0;j<c2;j++)
{
scanf("%d",&b[i][j]);
}
}
if(r1==c2)
{
for(i=0;i<r1;i++)
{
for(j=0;j<c2;j++)
{
for(k=0;k<c1;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
}
printf("\nresultant
matrix:\n"); for(i=0;i<m;i++)
{
for(j=0;j<q;j++)
{
printf("%d ",c[i][j]);
}
printf("\n");
}
}
getch();}
59

OUTPUT
Enter the rows and columns of
matrix1 2 2
Enter the rows and columns of
matrix2 2 2
Enter the elements of matrix1
5321

Enter the elements of matrix2


1111

Resultant Matrix
8833

RESULT
Thus the c program to perform the matrix multiplication has been successfully
completed and the output was verified.
60

SOLVING PROBLEMS USING STRING FUNCTIONS


Ex No: 7(a)
Date :

STRING LENGTH FUNCTION

AIM
To write a C program to find the string length and to reverse the given string.
ALGORITHM
Step 1: start the program.
Step 2: get the string.
Step 3: using strrev() fucntion to convert the reverse order of the string.
Step 4: using strlen() function to find the length of the string.
Step 5: print the string.
Step 6: stop the program.

61

PROGRAM
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
char str[50];
clrscr();
printf("\n\t Enter your name : ");
gets(str);
printf("\nReverse of string: %s",strrev(str));
printf("\nLength of String: %d",strlen(str));
getch();
}

62

OUTPUT:
Enter your name : Colllege
Reverse of string: EGELLLOC
Length of String: 8

RESULT:
Thus the program to reverse the string and to find the length of the string was
executed and the output was verified successfully.

63

Ex No: 7(b)
Date :

COPY TWO STRINGS

AIM:
To write a C program to copy the strings using strcpy()

ALGORITHM:
Step 1: start the program.
Step 2: get the string.
Step 3: copy the string into another string variable by using strcpy() fucntion
Step 4: print the string.
Step 5: stop the program

64

PROGRAM:
#include <stdio.h>
#include
<string.h> main()
{
char s1[20], s2[20];
printf("\nEnter string into s1: ");
gets(s1);
strcpy(s2, s1); printf("\ns2: %s", s2);
getch();
}

65

OUTPUT:
Enter string into s1: Engineering
s2: Engineering

RESULT:
Thus the program to copy the string was executed and the output was verified
successfully.
66

Ex No: 7(c)
Date :

CONCATENATE TWO STRINGS

AIM:
To write a C program to concatenate two strings using strcat()
ALGORITHM:
Step 1: start the program.
Step 2: get the first string.
Step 3: get the second string.
Step 4: using strcat() function to concatenate the string.
Step 5: print the concatenated string.
Step 6: stop

67

PROGRAM:
/**** Program to Concatenate Two Strings using strcat() ****/
#include <stdio.h>
#include
<string.h> main()
{
char s1[20], s2[20];
printf("\nEnter first string: "); gets(s1);
printf("\nEnter second string: ");
gets(s2);
strcat(s1, s2);
printf("\nThe concatenated string is: %s", s1);
getch();
}

68

OUTPUT:
Enter first string: College of
Enter second string: Engineering
The concatenated string is: College of Engineering

RESULT:
Thus the program to concatenate the string was executed and the output was
verified successfully.

69

Ex No: 7(d)
Date :

COMPARE TWO STRINGS

AIM:

To write a C program to compare two strings using strcmp().


ALGORITHM:
Step 1: start the program.
Step 2: get the first string.
Step 3: get the second string.
Step 4: using strcmp() function compare the two strings.
Step 5: else prints not equal.
Step 6: stop the program.

70

PROGRAM:
/*** Program to Compare Two Strings using strcmp() ***/
#include
<stdio.h>
#include
<string.h> main()
{
char s1[20], s2[20];
int result;
printf("\nEnter first string: ");
gets(s1);
printf("\nEnter second string: ");
gets(s2);
result = strcmp(s1, s2);
if (result == 0)
printf("\nBoth strings are equal");
else
printf("\nBoth strings are not equal");
getch();
}

71

OUTPUT:

Enter first string: college


Enter second string: engineering
Both strings are not equal

RESULT:
Thus the program to compare the string was executed and the output was verified
successfully.
72

PROGRAMS WITH USER DEFINED FUNCTIONS INCLUDES


PARAMETER PASSING
Ex No: 8(a)
Date :

FIBONACCI SERIES

AIM
Write a program to generate Fibonacci series in C program
ALGORITHM
Step 1: Start the process.
Step 2: Read the number of terms as input.
Step 3: Assign values to the variable f, s, t, i.
Step 4: Calculate the Fibonacci series using for loop.
Step 5: Save and execute the program.
Step 6: Display the result.
Step 7: Stop the process.
FLOWCHART

73

PROGRAM
#include<stdio.h>
#include<conio.h>
void fib(int n);
void main()
{
int num;
clrscr();
printf("\nenter the no of
terms"); scanf("%d",&num);
fib(num);
getch();
}
void fib(int n)
{
int x=0,y=1,z,i;
printf("\nfibonacci
series\n"); printf("%d
%d",x,y); for(i=2;i<n;i++)
{
z=x+y;
printf("
%d",z); x=y;
y=z;
}
}

74

OUTPUT

Enter the no of
terms 6
Fibonacci series is
011235

RESULT
Thus the c program generate the Fibonacci series has been successfully completed and
the output was verified.
75

Ex No: 8(b)
Date :

CALL BY VALUE

AIM
To write a C program to swap the given number by using call by value.
ALGORITHM
Step 1: Start the process.
Step 2: Assign values to the variable a and b.
Step 3: Pass the value of the variables to the function swap().
Step 4: Swap the values of the variable in the function swap().
Step 5: Save and execute the program.
Step 6: Display the result.
Step 7: Stop the process.

FLOWCHART

76

PROGRAM

#include<stdio.h>
#include<conio.h>
void swap(int a,int b);
void main()
{
int x=10,y=20;
clrscr();
swap(x,y);
printf("\nx=%d
y=%d",x,y); getch();
}
void swap(int a,int b)
{
int c;
c=a;
a=b;
b=c;
printf("\nx=%d y=%d",a,b);
}

77

OUTPUT

Before swapping
X=10
Y=20
After swapping
X=10
Y=20

RESULT
Thus the c program to swap the two number using call by value has been successfully
completed and the output was verified.
78

Ex No: 8(c)
Date :

CALL BY REFERENCE

AIM
Write a program to swap the given number by using call by reference in C program
ALGORITHM
Step 1: Start the process.
Step 2: Assign values to the variable a and b.
Step 3: Pass the address of the variable to the function swap().
Step 4: Swap the values of the variable in the function swap().
Step 5: Save and execute the program.
Step 6: Display the result.
Step 7: Stop the process.

FLOWCHART

Start

Read x,y

call swap(&x,&y)

print x,y

Stop

call swap(*a,*b)

c=*a
*a=*b
*b=c

Print *a,*b
79

PROGRAM

#include<stdio.h>
#include<conio.h>
void swap(int *a,int *b);
void main()
{
int x=10,y=20;
clrscr();
swap(&x,&y);
printf("\nx=%d
y=%d",x,y); getch();
}
void swap(int *a,int *b)
{
int c;
c=*a;
*a=*b;
*b=c;
printf("\nx=%d y=%d",*a,*b);
}

80

OUTPUT

Before swapping
X=10
Y=20
After swapping
X=20
Y=10

RESULT
Thus the c program to swap the two number using call by reference has been
successfully completed and the output was verified.
81

PROGRAM USING RECURSIVE FUNCTION AND CONVERSION


FROM GIVEN PROGRAM TO FLOWCHART
Ex No: 9
Date :

FACTORIAL USING RECURSION

AIM
Write a program to find the factorial of given number using recursive function in
C program
ALGORITHM
Step 1: Start the process.
Step 2: Assign values to the variable n.
Step 3: Read the value for the variable n.
Step 4: Check the condition for the variable using if loop
Step 5: Calculate the factorial using the formula fact(a-1).
Step 6: Save and execute the program.
Step 7: Display the result.
Step 8: Stop the process.
FLOWCHART

82

PROGRAM
#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{
int n;
clrscr();
printf("\nenter the number");
scanf("%d",&n);
printf("factorial=%d",fact(n));
getch();
}
int fact(int a)
{
int f; if(a==0)
return(1);
else
f=a*fact(a-1);
return(f);
}

83

OUTPUT

Enter the
number 5
Factorial:
120

RESULT
Thus the c program to find the factorial of given number using recursive function has been
successfully completed and the output was verified.
84

PROGRAM USING STRUCTURES AND UNIONS


Ex No: 10(a)
Date :

STUDENT DETAILS USING STRUCTURES

AIM
Write a program to display the student details using structure in C program
ALGORITHM
Step 1: Start the process.
Step 2: Create the structure with the name student and declare the variables.
Step 3: using for loop get the details of student such as name, roll no, mark1, mark2, and
total for
Step 4: Swap the values of the variable in the function swap().
Step 5: Save and execute the program.
Step 6: Display the result.
Step 7: Stop the process.

85

PROGRAM
#include<stdio.h>
#include<conio.h>
#include<string.h>
struct student
{
char name[20];
int rollno;
int mark1,mark2,mark3;
int total;
int avg;
char grade[20];
};
void main()
{
int i,n;
struct student
s[50]; clrscr();
printf("\enter the no of
students"); scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nenter the name");
scanf("%s",s[i].name);
printf("\nenter the rollno");
scanf("%d",&s[i].rollno);
printf("\nenter the marks");
scanf("%d%d%d",&s[i].mark1,&s[i].mark2,&s[i].mark3);
s[i].total=s[i].mark1+s[i].mark2+s[i].mark3;
s[i].avg=s[i].total/3;
if(s[i].avg>=75)
strcpy(s[i].grade,"distinction"); else
if(s[i].avg<75&&s[i].avg>=60)
strcpy(s[i].grade,"first class");
else if(s[i].avg<60&&s[i].avg>=50)
strcpy(s[i].grade,"second class");
else strcpy(s[i].grade,"third class");
}
printf("\nname\trollno\ttotal\taverage\tgrade");
for(i=0;i<n;i++)
{
printf("\n%s\t%d\t%d\t%d\t%s",s[i].name,s[i].rollno,s[i].total,s[i].avg,s[i].grade);
}
getch();
}

86

OUTPUT

Enter the name: Lenin


Enter the roll no: 95202205023
Enter the marks: 90 94 89
Enter the Name: Satheesh
Enter the roll no: 95202205024
Enter the marks: 90 98 85
Enter the Name: Abel
Enter the roll no: 95202205025
Enter the marks: 96 92 86
Name
Lenin
Satheesh
Abel

Roll No
95202205023
95202205024
95202205025

Total
273
273
274

Average
91
91
91

Grade
Distinction
Distinction
Distinction

RESULT
Thus the c program to display the student details using structure has been successfully
completed and the output was verified.

87

Ex No: 10(b)
Date :

STUDENT DETAILS USING UNION AND STRUCTURES

AIM
Write a program to display the student details using structure in C program
ALGORITHM
Step 1: Start the process.
Step 2: Create the structure with the name student and declare the variables.
Step 3: Create union and invoke structure details
Step 4: The details of the student.
Step 5: Save and execute the program.
Step 6: Display the result.
Step 7: Stop the process.

88

PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
{
struct student
{
char name[30];
char sex;
int rollno;
fload percentage;
};
union details
{
struct student st;
}
clrscr();
printf(Enter the details);
printf(nEnter the name);
scanf(%s, set.st.name);
printf(Enter the details);
scanf(%s,&
set.st.rollno); flushall();
printf(nEnter the sex);
scanf(%c,& set.st.sex);
printf(Enter the Percentage);
scanf(%f,& set.st.Percentage);
printf(n The student details are: n);
printf(Name : %s, set.st.name);
printf(Name : %d, set.st.rollno);
printf(Name : %c, set.st.sex);
printf(Name : %f, set.st.percentage);
getch();
}

89

OUT PUT
Enter details:
Enter name : Arull
Enter rollno: 10
Enter sex: M
Enter percentage: 89
The student details are:
Name : Arull
Rollno : 10
Sex : M
Percentage : 89.000000

RESULT
Thus the c program to display the student details using union and structure has been
successfully completed and the output was verified.
90

Ex No: 11(a) ADDING TWO NUMBERS USIGN COMMAND LINE ARGUMENTS


Date :

AIM
To write a c program to add two numbers using command line arguments.
ALGORITHM
Step 1: Start the program.
Step 2: Open Command Prompt inside Borland C/C++.
Step 3: Click on DOS Shell.
Step 4: Inside Command Prompt type this command, add 10 20.
Step 5: Type exit command to return to Turbo C/C++ Screen
Step 6: Stop the process.

91

PROGRAM:
#include<stdio.h>
void main(int argc, char * argv[])
{
int i, sum = 0;
if (argc != 3)
{
printf("You have forgot to type numbers.");
exit(1);
}
printf("The sum is : ");
for (i = 1; i < argc; i++)
sum = sum + atoi(argv[i]);
printf("%d", sum);
}

92

OUT PUT
The sum is: 30

RESULT
Thus the c program to copy one file to another has been successfully completed
and the output was verified.
93

Ex No: 11(b)
Date :

COPYING ONE FILE TO ANOTHER USING


COMMAND LINE ARGUMENTS

AIM
To write a c program to copy one file to another using command line arguments.
ALGORITHM
Step 1: Start the program.
Step 2: Open two files fp1 and fp2 by passing the file names through command line
arguments.
Step 3: Open two files using fopen() function.
Step 4: Until end of file reaches copy the contents of fp1 to fp2.
Step 5: If fp1 does not have any valid information, terminate the program.
Step 6: Close the files.
Step 7: Stop the process.

94

PROGRAM:
#include<stdio.h>
#include<conio.h>
void main (int argc,char *argv[])
{
FILE *fp1,*fp2;
char ch;
clrscr();
if(argc!=3)
{
printf("\n insufficient argument ");
exit(0);
}
fp1=fopen(argv[1],"r");
fp2=fopen(argv[2],"w");
if(fp1==NULL || fp2==NULL)
{
printf("\n unable to open file ");
exit(0);
}
while(!feof(fp1))
{
ch=fgetc(fp1);
fputc(ch,fp2);
}
printf("\n file successfully copied ");
fclose(fp1);
fclose(fp2);
getch();
}

95

OUT PUT
cc file1.c text1.txt text2.txt
./a.out
file successfully copied
Contents of text1.txt
Computer is an electronic device which gets an input from the user, processes it and gives the
output.
Contents of text2.txt
Computer is an electronic device which gets an input from the user, processes it and gives the
output.

RESULT
Thus the c program to copy one file to another has been successfully completed
and the output was verified.
96

Potrebbero piacerti anche