Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 62

SRI VENKATESWARA COLLEGE OF ENGINEERING

SRIPERUMBUDUR

DEPARTMENT OF INFORMATION TECHNOLOGY

LAB MANUAL

GE2115 - COMPUTER PRACTICE LABORATORY - I

I SEMESTER

ANNA UNIVERSITY – REGULATION 2008

Prepared by Approved by

Signature

Name Ms. P. Sharon Femi


Ms. L. Anita Elizabeth Dr .G.Sumathi
Designation Assistant Professor HOD-IT
Date 19.08.2010 19.08.2010

1
TABLE OF CONTENTS

Exercise No Exercise Name

Word Processing
1 Document creation, Text manipulation with Scientific
notations.
Word Processing
2 a. Table creation, Table formatting and Conversion
b. To create an advertisement in Word.
Word Processing
3 To illustrate the concept of mail merging and letter
preparation.
Word Processing
4 Drawing - flow Chart
Spread sheet
5 Chart - Line, XY, Bar and Pie.
Spread sheet
6 Formula - formula editor.
Spread sheet
7 Inclusion of object, Picture and graphics, protecting the
document and sheet. Auto Filtering
Spread sheet
8 Sorting and Import / Export features.
Data types, Expression Evaluation, Condition
Statements.
a. Round of an integer
b. Quadratic equation
c. Armstrong number
d. Palindrome Number
e. To write a program for electricity bill preparation.
9 f. To write a simple menu driven calculator program
using switch statement
g. To write a program to find the largest digit of a
number
h. To write a program to print the sine and cosine
series.
i. To write a program to generate prime numbers.

2
TABLE OF CONTENTS

Exercise No Exercise Name

Arrays
a. Linear Search
b. Bubble sort
c. Matrix addition
d. To write a program to perform Matrix
multiplication.
10 e. To write a program to input a 3x3 Matrix and
display it with the sum of the rows and columns.
f. To write a program to perform string
manipulation functions like string concatenation,
comparison, find the length and string copy
without using library functions.
g. To write a program to arrange names in
alphabetical order

Structures and Unions


a. To print the mark sheet of n students using
11 structures.
b. To print the difference between two dates using
structures
To print the employee payroll using unions.

Functions
a. To write a C program to calculate the mean,
variance and standard deviation using functions.
b. To write a C program to perform sequential and
12 binary search using functions
c. To write a program to print the Fibonacci
series using recursion
d. To calculate the factorial of the given number
using recursion

3
Ex no: 1

DOCUMENT CREATION, TEXT MANIPULATION WITH SCIENTIFIC NOTATIONS

PART-A

Perform the following in MS-Word

i. Create a new word document and type the following text:

A ROBOT IN THE HOUSE

‘Correction. You are in error. You are miss informing your father. Correction. The work
has not been done. Your computer has not been used. ERROR, ERROR”. The robot’s
voice was metallic.

TARUN: You are so lucky Adyta! Manku can do so many things. It can clean the house.
It can answer the telephone, call the doctor and it can even open the door.

ADITI: Wait! There are so many things it can’t do. It can’t laugh. It can’t do MY
HOMEWORK FOR ME. It can’t even help me decide what should I wear for the party.

ii. Save the document as DOCUMENT.DOC

• Go to file menu with cursor, select option ‘save’, then type ‘document.doc’ then
click save.
• The document is saved under that name

iii. Insert the following text before the conversation between Aditi and Tarun

“Oh! Stop interrupting, Manku”. Aditi said angrily. “You’re are not supposed to
participate in every conversation”

• Click the cursor in between the conversion


• Click enter and type the paragraph given

iv. Make the story heading bold, italic and 14 pts.

• Mark the heading with cursor and then click on the bold, italic and the letter size
icons.

v. Change the font style of entire story to MS-Comic Sans

• Click on the font icon and click on ms comic sans. The change is made.

4
vi. Select the heading of the document, cut and paste it at the end of the
document

• Select the heading and click the right button of cursor and choose cut
• Move the cursor to the end of the document, again click the right key and click
past.

vii. Undo the previous action

• Select the heading; press the right button mouse, click cut.
• Move cursor to the top of the document and click paste.

viii. Select the first two lines of the paragraph and convert it to uppercase

• Select lines with cursor, then go to format


• Click change case and choose upper case

ix. Change all the uppercase letters to lowercase and vice-versa

• Select all the uppercase, goto format choose change case to lower case and vice
versa

x. Change the font style of the last paragraph 12 pts bold italic

• Select the last para and click on the 12 size and italic icon

xi. Copy this format to the first paragraph using format painter

• Select the para and click on format painter icon

xii. Highlight the second paragraph (Hint: use highlighter or formatting toolbar)

• Select 2nd para and click on the hightlight icon

xiii. Change the font size of the entire text to 14 pts

• Select the whole text and click on the size icon to 14 pt

xiv. Make a copy of this document with a different name (MYBOOK.DOC)

• Select file from main menu and click on ‘save as’ and types the name, the
document is copied.

xv. Select the second paragraph of DOCUMENT.DOC and delete it


• Select the para, click on the left key of the cursor then delete

5
xvi. Undo the above action and see the effect

• Click on undo, the second para appears

xvii. Redo the above action and see the effect

• Click on redo, the second para disappears.

xviii. Delete the entire document (DOCUMENT.DOC)

• Select file from main menu. Click on document.doc and click delete.

xix. Open the document MYBOOK.DOC

• Click the open menu and choose mybook.doc

xx. Show all the nonprinting characters in this document.

• Click on “P” to show the non-printing characters.

PART-B

Open document MYBOOK.DOC and perform the following task.


i. Note down the default margins of MYBOOK.DOC

• Select format from main menu


• Click on ‘Paragraph’.
• A window opens stating the margins

ii. Format the first paragraph with the following measurements:


Alignment: justified
Indentation: Left:0. 4”, Right:0. 4”
Special: First line by 0.5”
Line spacing: 1.5 lines

Select Format and then Paragraph, make the required changes specified above

iii. In the end of MYBOOK.DOC type:


“MANKU IS A ROBOT NOT A HUMAN BEING.”

The cursor is brought down to the end of the document and the sentence is
typed.

• Make 12 copies of the statement written above and apply all the text
Attributes

6
• Highlight the statement, right click the mouse button, select copy (or) select copy
from ‘edit’
• Using paste option 12 copies are made
• Choose the ‘Font’ option from format and give text attributes like style, change in
style etc.

iv. Using different tab stops type the following data in the next page of
MYBOOK.DOC

APEX POLYMERS

S.No Emp# Employee Name Address Salary


1 E001 Aditi 31/9,Dr.Mukherjee Nagar 4000
2 E002 Bharti 1292, Jawahar Colony 3000
3 E003 Pradeep 19/12,Dr.Mukherjee Nagar 3050
4 E004 Arora A-91,Jawahar Colony 8000
5 E005 Narula 63/2,Patel Nagar 4000
6 E006 Kaur 72/9,Outram Lines 2050
7 E007 Savita 19/AZ, Dr.Mukherjee Nagar 3050
8 E008 Gaurav A6/212,Panchakula 6750
9 E009 Avneet 101/B6,Outerm lines 5000
10 E010 Kriti 28/222,Nirankari Colony 4000

• Select format from main menu and choose tabs after going to the next page using
the cursor
• Fill the option ‘Tab stop position’ to be set for each heading and click set and
then ok
• So equal spacing will be given according to the position filled

v. Give a border to the above written text

• Highlight the written text


• Select the border icon from the format menu.
• Hence border is formed

vi. Search for the word ROBOT and replace it with ‘ROBOT machine’

• Select Edit from menu and choose Find


• A window opens and fill the Find and Replace options respectively
• Click Replace All

vii. Write the following text in the next page of the same document
(MYBOOK.DOC)

7
If you cry nobody will cry with you but 
If you laugh everybody will laugh with
you.

SO ALWAYS LAUGH

SO ALWAYS LAUGH

• Select Toolbasr from View & click on Drawing


• Icons appear at bottom. Select Autoshapes and then Callouts
• Select the cloud shape and fill the sentences inside

viii. Insert a page break before the conversation between Tarun and Aditi

• Select the line between the conversation


• Select break from insert menu
• Select page break, click ok

ix. Open a new document and insert the table with the following data:

First Name Last Name Phone Address

Sangeeta Malik 5236987 32/8,Dr.Mukherjee Nagar


Preeti Ahuja 1457896 A-E/269,Shalimar Bagh
Meenu Kataria 3205623 B-P/81,B.P.Colony
Mandeep Kaur 4579681 25/K9,Outram Lines
Teena Gulati 1257936 SU-23,Dr.Mukherjee Nagar

• Select Draw table from Table options and draw a table in the document
• Choose Split cells from Table, fill in Rows and Columns, fill in the data.

x. Save and close the document with address.doc

• Click on Save icon and give the name and then click Close in File menu

8
xi. Again open the document MYBOOK.DOC and got the end of the
document in one step

• Click the Open menu, type the name, when document appears, click Ctrl+End

xii. Print preview the page containing the drawing features and use the zoom
feature to view this in different percentages.

• Select File & choose Print Preview


• The pages appear in miniature
• Use zoom lens to maximise

xiii. Use the auto correct feature of work to add short forms for:

I. AP Apex Polymers
II. V&A Vicky & Associates
III. BPL British Petroleum Limited
IV. PACE PACE Academy of Computer Education
V. IP Informatics Practices

• Select Tools from main menu and choose Auto correct


• In the window fill Replace option with the respective word

xiv. Provide headers and footers in MYBOOK.DOC (headers should be


different for first page, even and odd pages). For first page give header
“A ROBOT IN THE HOUSE”. For even page give header “MY
DOCUMENT” and right align it, for odd pages give header “ODD
PAGE” page and left align it. Also provide page numbers as footer
(centrally align)

• Select Header and Footer option from View


• Choose Page Setup from the opened column
• Give specific headers to the specific page, for alignment use the icon in desktop
• For footers choose page no. In the column and fill it respectively

xv. Type in the following contents in the same document MYBOOK.DOC

A word processor (such as MS Word) is a computer program that enables


you to create, edit, print and save documents for future retrieval and
revision.
In case of typewriter, input and output are inseparable. It means,
whenever a key is depressed i.e., input is fed to machine, a character is
printed on the sheet i.e., and an output is generated. Thus, one is denied
the facility to shape the output separately. Even in the case of electronic
typewriters with memory, the storage capacity for text and facilities for
9
its manipulation are extremely limited. Facility for storing the input to
some external medium before producing the output provided an ideal
solution to this problem.
Convert the above text in two-column text.

• Select Columns from Format in main menu and click on 2 columns.

xvi. Spell check your document an correct all the grammatical as well as
spelling mistakes

• Select Tools, click Spellings and Grammer.

xvii. Close your document

• Select Close from the File, document is closed

Part C

Edit the following documents

• Select Insert menu and click the object


• Include the Formula Editor
• Edit the above formulas
• Save the document
• Close the documents

10
Ex no: 2a
Table creation, Table formatting and Conversion

i. Open a new document and insert a table with the following data:

First Name Last Name Phone Address


Sangeeta Malik 5236987 32/8,Dr.Mukherjee Nagar
Preeti Ahuja 1457896 A-E/269,Shalimar Bagh
Meenu Kataria 3205623 B-P/81,B.P.Colony
Mandeep Kaur 4579681 25/K9, Outram Lines
Teena Gulati 1257936 SU-23,Dr.Mukherjee Nagar
• Select Start menu
• Select Programs option
• Select Microsoft Word from Programs Sub menu.
• Select New option from the File menu of MS Word Window.
• Or Click on the new document icon found on the standard toolbar.

• On the Table menu, point to Insert, and then click Table option.
• Type the number of rows and columns in the Insert Table dialogue
box.
• Or you can use the Draw Table tool from Table menu to create a
table. First, draw a line from one corner of the table to the corner
diagonally opposite in order to define the boundary of the entire table,
and then draw the column and row lines inside.
• Type the given data.

ii. Save the document with address.doc


• On the File menu, select Save option.
• Type the document name as address.doc in Filename textbox.
• Click the Save button.

iii. Select the first Row and Bold the Text.


• Select the text, which you want to make as Bold, from the table by
dragging the mouse across it.
• Click on Bold button on Formatting tool bar.
• Or use shortcut keys CONTROL+B.
• Or on the Format menu, select Font option.
• Select Font Style as Bold in the Font tab.
• Click OK button.

11
iv. Align the text in the first row to “Center” and align the text in the
remaining rows to “Left”.
• Block the text in the first row of the table by dragging the mouse
across it.
• Click on Center button on the Formatting toolbar.
• Block the text in the remaining rows.
• Click on Align Left button on the Formatting toolbar.
• Or on the Format menu, select Paragraph option.
• Select the options from the Alignment combo box in the Indents and
Spacing tab.
• Click OK button.

v. Insert a New Column to the beginning of the table with the following data.
S.No
1
2
3
4
5
• Use a mouse to place the cursor at the beginning column of the table.
• On the Table menu, point to Insert, and then click Columns to the
Left.
• Type the given data in the inserted column.

vi. Add a New Row to the End of the Table.


• Use a mouse to place the cursor at the end row of the table.
• On the Table menu, point to Insert, and then click Rows Below
option.

vii. Insert a New Row between 3 and 4.


• Place the mouse cursor at the 3rd row of the table.
• On the Table menu, point to Insert, and then click Rows Below
option.

viii. Insert a New Column between 4th and 5th Column.


• Place the mouse cursor at the 4th column of the table.
• On the Table menu, point to Insert, and then click Columns to the
Right option.

ix. Change the size of the second column’s width.


• Place the mouse cursor on the column of the table where you want to
change.
• On the Table menu, point to Table properties, and then select
Column tab.
• Select the required width from the Preferred width combo box.

12
• Click OK button.

x. Sort the data according to alphabetical order of “First Name”.


• Select the Column or cells you want to sort.
• On the Table menu, click Sort.
• Select the sort options you want.
• Click Options.
• Select Column Only check box.
• Click OK button.

xi. Delete the third row and third Column from the table.
• Place the mouse cursor on the 3rd row.
• On the Table menu, point to Delete, and then select Rows.
• Place the mouse cursor on the 3rd Column.
• On the Table menu, point to Delete, and then select Columns.

xii. Create a new row at the top of your table, merge the cells, and add a title
to the table.
• Place the mouse cursor on the first row.
• On the Table menu, point to Insert, and then click Rows above.
• Block that row, by dragging the mouse across it.
• On the Table menu, click Merge Cells.
• Then type the title of the table.

xiii. Convert the given text into a table.


Item Color, Style,
Bus Blue, A980,
Van Red, X023,
Car Green, YL724
Select the text u want to convert, by dragging the mouse across it.
• On the Table menu, point to Convert, and then click Text to
Table.
• Under Separate text at, click the option for the separator character
you want and then click OK.

xiv. Split the above table into two tables


• Place the mouse cursor on the table where you want to split it.
• On the Table menu, select Split Table.

xv. Apply Borders, Shading and Color to the table.

13
• Select the cell, rows, or columns you want to add borders, shading
and color.
• Either right click within your table and choose Table properties or
click within your table and go to Table on the menu bar and choose
Table properties.
• The Table properties dialog box will open.
• Click on the Borders and Shading button.
• Choose the setting style, the color and the width that you want.
• Click OK then new settings will be added to the table.
• Or on the Table menu, click Table AutoFormat.
• In the Formats box, click the format you want.
• Then click OK button.

xvi. Spell check your document and correct all the grammatical errors as
well as spelling mistakes.
• On the Tools menu, click Spelling and Grammar Check option.
• The errors are shown in red colour.
• From the list of Suggestions choose one.
• Click change or ignore.
• Continue till all errors are rectified.

xvii. Save the above document as table.doc


• Select File menu.
• Select Save option.
• Type the document name as “table.doc” in Filename textbox
• Click the Save button.

xviii. Close your document.


• Select File menu.
• Select Close option.
• Select Exit from File menu to quit the application.

14
Ex no: 2b
ADVERTISEMENT

A BRIGHT CAREER IN INFORMATION TECHNOLOGY

TREND REPORT: The Hybrid Model–Solution for Challenges in Managing an


Offshore Captive Center

Abstract

A recent survey conducted jointly by •Aligning the offshore team with your
Outsourcing Center and Wipro organization’s culture and business
Technologies indicates companies still imperatives
have significant challenges in managing •Lack of a long-term strategy or vision
their captive offshore centers. for your captive offshore operation
•Lack of adequate management
The survey, which was not a scientific bandwidth to effectively manage the
study, polled visitors at the Outsourcing model
Center portal during May 2006. It asked
CIOs and Global Sourcing Managers to This discusses the survey’s findings as
choose which of the following four well as some best practices to combat the
factors is their key challenge in challenges of a captive offshore center. It
managing an offshore captive center: also discusses the trend of using a hybrid
model— part captive, part outsourcing—
•Rapid scalability of workforce and as the solution for these challenges.
infrastructure while maintaining the cost
advantage

15
To create the advertisement in word.

• Open a new word document.


• Type the heading and select the font as Times New Roman, font style as Title color and
the font size as appropriate.
• Select Insert -> Picture -> ClipArt and select the picture.
• Select Tools -> Customize -> Toolbars -> Drawing and Word Art.
• Select any one WordArt Style and insert in the document.
• Type the given article and select Format -> Columns and select two columns.
• Insert the given shapes by selecting Auto shapes from the Drawing Toolbar.
• Apply border to the entire page by selecting Format -> Borders and Shading.
• Select View -> Header and Footer and add the necessary details.
• Save the document as advertisement.doc.
Ex no: 3
Mail merge and Letter preparation

i Open a new document and type the following letter.

Sep 01,2008,
Chennai.

From
VENKATESH .P
Sri Ranga Apartments,
No: 120, II Avenue,
T. Nagar.
Chennai-17.

To

Dear Sir/Madam,
With the current slow down in hiring within the high- tech field, you must be flooded with
resumes from out-placed software engineers such as myself. Please take a moment to consider
my qualifications. I believe in particular is highly marketable in this tight market:

 I worked on the team that pioneered the technology that put the PalmPilot on the map.
In today’s increasingly mobile society, this technology has places to go, and I have ideas that
could take us to the next step in office independence.
Please call me with prospective job opportunities. I am interested in a project management
position in the $95K range.

Thank you!

Venkatesh. P

Enclosure: Resume.
• Select Start menu
• Select Programs option
• Select Microsoft Word from Programs Sub menu.
• Select New option from the File menu of MS Word Window.
ii. Save the document as “Letter.doc.”
• Select File menu.
• Select Save option from File menu.
• Type the document name as “Letter.doc” in Filename textbox.
• Click the Save button.

iii Send the document to 10 recipients using Mail merge.


(Use 10 different addresses)
• On the Tools menu, select Mail Merge option.
• Click on Create and select Form Letter.
• Click on Active Window in the appearing dialogue box.
• On Data source menu, point to Get Data, then select Create Data
Source.
• Choose the fields you wish to include in your data source from a list of
default field names.
• To add a field name, type the name in the Field Name box and click the
Add Field Name>> button. To remove a field name, click on the name to
highlight it and then click on the Remove Field Name button.
• Click the OK button
• Save your mail merge data source as a document.
• Select Edit Data Source in the appearing dialogue box.
• Enter the information for each person in each of the fields
• After entering all of the desired records, click the OK button.
• To insert a merge field click Insert Merge Field on the Mail Merge
toolbar. And you will need to insert any punctuation or spaces in the field
layout.
• Type the given letter.
• On the Tools menu, click the Merge command on the Mail Merge option.
• Select New Document from the Merge To: drop list.
• Choose All radio button to merge all records.
• Then click Merge button in the dialogue box.
• This will set all the form letters into a new document, which you can save
and/or print.

iv Close the document.


• Select File menu.
• Select Close option.
• Select Exit from File menu to quit the application.
Ex no: 4
Drawing Flowcharts

1.Draw a flowchart to find the sum of first 50 natural numbers


2.Draw a flowchart to find the largest of three numbers A,B, and C.
3.Draw a flowchart for computing factorial N (N!) Where N! = 1 X 2 X 3 …… N .

• Right click on the tool bars


• Click and include the drawing tool bar
• Click Auto shape
• Select flow chart
• Click on the symbol .Drag on the document. Add text

Flowchart

A flowchart illustrates the steps in a process. By visualizing the process, a flowchart can quickly
help identify bottlenecks or inefficiencies where the process can be streamlined or improved.

Alternate Definition:

The flowchart is a means of visually presenting the flow of data through an information
processing systems, the operations performed within the system and the sequence in which they
are performed

MEANING OF A FLOWCHART

• A flowchart is a diagrammatic representation that illustrates the sequence of operations to


be performed to get the solution of a problem.
• Flowcharts are generally drawn in the early stages of formulating computer solutions.
• Flowcharts facilitate communication between programmers and business people.
• These flowcharts play a vital role in the programming of a problem and are quite helpful
in understanding the logic of complicated and lengthy problems.

Basic Flowcharting Shapes

Flowcharts use special shapes to represent different types of actions or steps in a process. Lines
and arrows show the sequence of the steps, and the relationships among them.
Guidelines in Flowcharting:

a. In drawing a proper flowchart, all necessary requirements should be listed out in logical
order.
b. The flowchart should be clear, neat and easy to follow. There should not be any room for
ambiguity in understanding the flowchart.
c. The usual direction of the flow of a procedure or system is from left to right or top to
bottom.
d. Only one flow line should come out from a process symbol.

(OR)
e. Only one flow line should enter a decision symbol, but two or three flow lines, one for
each possible answer, should leave the decision symbol.

f. Only one flow line is used in conjunction with terminal symbol.

g. If the flowchart becomes complex, it is better to use connector symbols to reduce the
number of flow lines. Avoid the intersection of flow lines if you want to make it more
effective and better way of communication.
h. Ensure that the flowchart has a logical start and finish.
i. It is useful to test the validity of the flowchart by passing through it with a simple test
data.

ADVANTAGES OF USING FLOWCHARTS

1. Communication: Flowcharts are better way of communicating the logic of a system to all
concerned.
2. Effective analysis: With the help of flowchart, problem can be analysed in more effective
way.
3. Proper documentation are made
4. Efficient Coding are developed
5. Proper Debugging are made.
6. Efficient Program Maintenance is achieved.

LIMITATIONS OF USING FLOWCHARTS

1. Complex logic: Sometimes, the program logic is quite complicated. In that case,
flowchart becomes complex and clumsy.
2. Alterations and Modifications: If alterations are required the flowchart may require re-
drawing completely.
Example of a Basic Flowchart:
Exercises On Flowcharting:

1. Draw a flowchart to find the sum of first 50 natural numbers.


2. Draw a flowchart to find the largest of three numbers A,B, and C.
3. Draw a flowchart for computing factorial N (N!)

Where N! = 1 ´ 2 ´ 3 ´ …… N .
Ex no: 5
Charts- Line, XY, Bar and Pie.
Problem 1:

Type the following data:


Sales report for the first quarter – 2004

A B C D E
1 Vehicle Jan Feb Mar Total
2 Car 250 300 310
3 Auto 54 92 20
4 Jeep 91 120 11
5 Van 125 119 78
6 Total

1. Make sure that appropriate formulas are entered in column E so that total sales of each
vehicle is shown properly. Similarly, in row 6 type correct formulas so that total sales for
each month is shown in respective columns.

 Open a new workbook window.


 Build the above table, starting from cell A1.
 Type the Formula (= sum (B2:D2 )) in cell E2 to calculate Total.
 Drag through the range (E2 to E5) and then press enter key.
 Similarly type the formula in cell B6 and drag up to D6 to calculate the total for every
month.

2. Draw a Pie Chart to show vehicle wise total sales made between Jan and Mar 2004.
Total sales of each vehicle must be shown as a sector.

 Select the data to be charted.


 Choose Chart from the Insert menu or click on the ChartWizard button.
 Select the chart type: Pie and click on the Next button.
 Read the dialog box, make sure the range is correct and then click the Next button.
 Enter the Chart title, Category (x) axis, value (y) axis and click on next button to
continue.
 Click once on the As object in radio button and specify the object name.
 Click on the finish button and get the desired chart on the workbook.
Pie chart

24%
Car

48% Auto
Jeep
18%
Van
10%

3. Draw a bar graph/column chart to show sale of vehicles for each month.

 Highlight the data to be charted.


 Choose Chart from the Insert menu.
 Choose the chart type: Column and then select the desired chart sub-type from the
samples on display. click on the Next button.
 In the dialog box, the default radio button for Columns would be selected. If the
range is correct, click on the Next button.
 Select titles tab from the dialog box and enter the Chart title, Category (x) axis,
value (y) axis.
 Click on the legend folio and select the desired placement where the legends should
be displayed .Click on the next button
 Click once on the As object in radio button and specify the object name.
 Click on the finish button and get the desired chart on the workbook.

column chart

1000

Series1
total

500
Series2
0 Series3
Car Auto Jeep Van Total Series4
vehicles
4. Draw a stacked bar graph to show the sale of each vehicle in comparison with the total
sales for the month.

 Highlight the data to be charted.


 Choose Chart from the Insert menu.
 Choose the chart type: Bar and then select the desired chart sub-type from the
samples on display. click on the Next button.
 In the dialog box, the default radio button for Columns would be selected. If the
range is correct, click on the Next button.
 Select titles tab from the dialog box and enter the Chart title, Category (x) axis,
value (y) axis.
 Click on the legend folio and select the desired placement where the legends should
be displayed .Click on next button.
 Click once on the As object in radio button and specify the object name.
 Click on the finish button and get the desired chart on the workbook.

Stacked Bar graph

Total
Series1
Vehicles

Jeep Series2
Series3
Car

0 500 1000 1500 2000


Total

5. Draw a Line graph to show the sales trend over the first quarter of the year 2004.

 Highlight the data to be charted.


 Choose Chart from the Insert menu.
 Choose the chart type: Line and then select the desired chart sub-type from the
samples on display. click on the Next button.
 In the dialog box, if the range is correct, click on the Next button.
 Select titles tab from the dialog box and enter the Chart title, Category (x) axis,
value (y) axis.
 Click on the legend tab and select the desired placement where the legends should be
displayed .Click on next button.
 Click once on the As object in radio button and specify the object name.
 Click on the finish button and get the desired chart on the workbook.

Line Chart

1000
Car
Total

500 Auto
Jeep
0
Van
1 2 3 4
Total
months

6. Type the following data in column F

F
1 Cost
2 200000
3 700000
4 900000
5 1000000

Draw an XY – graph comparing two numerical variables viz., cost of the vehicle and
sale of the vehicle.

 Enter the above data to the worksheet .


 Select the total and cost columns from the worksheet.
 Choose Chart from the Insert menu.
 Choose the chart type: xy(scatter) and then select the desired chart sub-type from the
samples on display. click on the Next button.
 In the dialog box, if the data range is correct, click on the Next button.
 Select titles tab from the dialog box and enter the Chart title, Category (x) axis,
value (y) axis.
 Click on the legend tab and select the desired placement where the legends should be
displayed .Click on next button.
 Click once on the As object in radio button and specify the object name.
 Click on the finish button and get the desired chart on the workbook.
XY chart

1500000
1000000

Cost
Series1
500000
0
0 500 1000
Total

Problem 2:

Create title for the graph as ‘Sales Report for the first quarter – 2004’

1. Create legends for all the data ranges in the graphs/charts drawn in problem 1.

 Click on the chart to which, you wish to apply legend .


 Choose chart options from the chart menu or right-click the chart to select chart
options
 Select the titles tab from the dialog box and give the chart title as specified above.
 Select the legends tab from the same dialog box and check the show legend option .
 choose the desired placement where the legends should be displayed on the chart.

Sample chart with legends

Line chart
Series1 Series2 Series3 Series4

1000
total

500

0
Car Auto Jeep Van Total
vehicles

2. Display horizontal vertical grids.

 Click on the chart to which, you wish to apply gridlines .


 Choose chart options from the chart menu or right-click the chart to select chart
options
 Select the gridlines tab from the dialog box and check the major and minor gridlines
option for x and y-axis.
 Then press ok button to draw gridlines on the chart

Sample chart with Gridlines

Stacked Bar graph

Total Series1
Vehicles

Jeep Series2
Series3
Car

0 500 1000 1500 2000


Total

Problem 3:

Write macros for the following:

1. To auto fill a range viz., A1..C5 with values starting from 1, increasing in steps of 5.

2. To draw graphs automatically for the problem given in problem 1.

 Highlight the data to be charted.


 Press F11 key to draw the graph automatically.
Ex no: 6
Formula - Formula editor
PROBLEM 1:

GLOBAL SOFT Company keeps the employees’ payroll data in a worksheet as shown below.

A B C D E
1 GLOBAL SOFT COMPANY
2 Emp No. Name Salary
3 1 Meena 24500
4 2 Vishal 10500
5 3 Elisa 14790
6 4 Richa 14000
7 5 Swetha 15250
8 6 Dravid 16000
9 7 Sourav 14100
10

i) Enter the above data in a worksheet and save the workbook as EMPLOYEE.XLS

 Choose New from the File menu.


 Starting from cell A1, build the above table.
 Choose Save from the File menu or click on the Save button.
 In the dialog box, specify file name as EMPLOYEE.XLS.

ii) Calculate HRA, DA, PF and Net salary for each employee.

HRA - 20% of basic salary


DA - 28% of basic salary
PF - 10% of basic salary

a. Type HRA, DA, PF, Net salary in cells D2, E2, F2 & G2.
b. Enter the formula (=C3*20/100) in cell D3 to calculate HRA.
c. Drag through the range you want and then press enter.
d. Similarly calculate DA, PF, Net salary for each employee.

iii) Save the workbook again.

a. Click on the save button.


PROBLEM 2:

The Hindustan departmental store has organized an Off Season sale. The details of the items on
sale and the percentage of discount offered are entered in a workbook as shown below.

A B C D E
1
HINDUSTAN DEPARTMENTAL STORE

2 Item Name Original Price Discount Selling


(%) Price
3 Ponds 98 10
4 Vicco 88 8
5 Lakmi 102 9
6 Farex 300 12
7 Denim 500 15
8 Biotiq 400 10
9

i) Enter the given data in a workbook and save the workbook as HINDUSTAN.XLS

 Choose New from the File menu.


 Starting from cell A1, build the above table.
 Choose Save from the File menu or click on the Save button.
 In the dialog box, specify file name as Hindustan.xls.

ii) Calculate the Selling Price of each item and display in column D of the sheet.

Formula to calculate the selling price of an item:

Selling price = original price – ((discount/100)* original price)

b. Enter the given formula in cell D3 to calculate selling price.


c. Drag through the range you want and then press enter.

iii) Save and close the workbook.

d. Click on the save button to save your workbook.


e. Choose Exit option from the file menu to close the workbook
PROBLEM 3:
Create an EXCEL sheet with consumer number, name, type (H / C), previous reading, current
reading, chargeable unit, and cost per unit and calculate the total amount to be paid using the
following condition.

• Starting from cell A1, build the table with consumer number, name, type (H / C),
previous reading (PR), and current reading (CR).
• Calculate chargeable units (CU) using the formula CU= CR-PR
• Calculate the Cost/Unit using the above table by writing the formula using IF and
AND conditions in the formula bar.
• Calculate the amount as the product of CU and Cost/Unit.

PROBLEM 5:

Create Transport reservation sheet with following description.


Passenger Name (not to exceed 20 characters) with interactive display and a request to enter
the name Options for gender Male/Female Seat no, class: 1st, 2nd, 3rd select as required.
Amount 1st class – Rs.500, 2nd class – Rs.400, 3rd class – Rs.200
Starting from cell A1, build the table. To give interactive display and a request to enter error
message, select Data -> Validation and give the corresponding settings.
• Display the amount using the formula bar

PROBLEM 6:
Create an electronic spreadsheet for income tax calculation by entering name, gross salary and
savings
Upto 1.5 lacs ------ NIL
1.5 – 3 lacs ------- 10%
3 – 5 lacs ------- 20%
5 –25 lacs ------- 30% Calculate the taxable amount and tax for individual person.
Starting from cell A1, build the table with name, gross salary and savings. Find the taxable
amount
• Calculate the tax using the above conditions in the formula bar.
Ex no: 7

SPREAD SHEET-INCLUSION OF OBJECTS, PICTURES AND GRAPHICS,


PROTECTING THE DOCUMENT AND SHEET, AUTOFILTERING

Steps for Inclusion of Objects

 Select the Object option from the Insert menu.


 In the dialogue box Create New and Create from file tabs are displayed.
 Select Create New and object type for including a new object in the sheet.
 Select Create from file and browse the file for including an existing object to the sheet.

Steps for inserting pictures and Graphics

 Select the Clip art option from Picture sub-menu of the Insert menu.
 From the dialogue box displayed click on the graphic selected by you and click on the
Insert Clip to add the image to the worksheet.
 Preview Clip to view the image full-size before adding it to the worksheet Drag the
bottom, right corner of the preview window to resize the image and click the "x" close
button to end the preview
 Add Clip to Favorites will add the selected image to your favorites directory that can be
chosen from the Insert ClipArt dialog box.
 Find Similar Clips will retrieve images similar to the one you have chosen.
 Continue selecting images to add to the worksheet and click the Close button in the top,
right corner of the Insert ClipArt window to stop adding clip art to the worksheet

Steps For Protecting A Document

 Choose the protect sheet command from the protection sub-menu of tools menu.
 Type password and click on the ok button
 Re enter the password to confirm that you have not made any mistake and click on the
OK button again.
 Save and close the worksheet
 Reopen the workbook using the file open command. Now if you try to edit the workbook
one message box will appear informing you that since the cells are protected you can’t
modify them.
 Click on the OK button to close this message box..

To unprotect the document choose unprotect sheet command from the Protection submenu
of Tools menu.

Steps for entering data using Form command


 Choose the form command from the Data menu.
 Type the required data in the fields

Problem:

Create an EXCEL sheet for the student details in a class for grade calculation:
(i) Passed in all subjects (ii) Avg ≥ 90 grade is O, Avg ≥ 80 grade is A, Avg ≥ 70 grade is B,
Avg ≥ 60 grade is C, Avg ≥ 50 grade is D. Apply filtering options.

• Starting from cell A1, build the table with student number, name, marks for 3
subjects.
• Check the result of the student and display it. Calculate the average
• Calculate the grade using result and average in the formula bar.

Steps For Filtering options

• Select all the data fields including the titles.


• Choose the Autofilter command from the Filter sub-menu of Data menu.
• The fields can now be viewed customizely.
Ex no: 8
SORTING AND IMPORT/EXPORT FEATURES

Steps for Sorting data

 To execute a basic descending or ascending sort based on one column, highlight the cells
that will be sorted .
 Click the Sort Ascending (A-Z) button or Sort Descending (Z-A) button on the standard
toolbar.
 Click on OK to execute the data sort command.

Steps for Import Features

 Select Import data option from Import External Data sub-menu of the Data menu.
 Select the data source from the dialogue box displayed.
 Click on OK to import.

Steps for Export Features

 Choose Save as command from the file menu


 In the dialog box opened click on the combo list for the save as type option and select the
format in which you wish to save the current file.
 Click on the save button
Excel would display a message box which will alert you that if you save the file in the new
specified format some of the data and features of the current file would be lost and only the
result of these formulas would be saved. Click on the Yes button if you are sure that you
need to save the file in the newly specified format.
Ex no: 9a

Round off an integer


Aim

To round off an integer to the next largest multiple of another integer.

Algorithm Description

1. Input the value of the integer to round off and store in integer variable i. Input the other
integer to whose multiple has to be rounded off to and store in integer variable j.
2. Round off the value of i to the next largest multiple of j and store the value in integer
variable k using the formula
k= i+j – i(mod)j
3. Print the value of variable k onto the screen.
4. Stop.

Sample Output
ENTER THE INTEGER TO BE RONDED OFF: 256
ENTER THE ANOTHER INTEGER: 7
THE RONDED OFF INTEGER IS 259

ENTER THE INTEGER TO BE RONDED OFF: 57


ENTER THE ANOTHER INTEGER: 8
THE RONDED OFF INTEGER IS 64
Ex no: 9b

Roots of a Quadratic equation


Aim
To find the roots of a given Quadratic equation.

Algorithm Description
1. Input the co-efficients of the quadratic equation ax²+bx+c through the keyboard
and store the values in floating point variables a,b,c respectively.
2. Compute the value of b²-4ac and store in floating point variable d.
3. Check if the value of d is greater than 0. If it is, goto step 3, otherwise goto step 6
4. Compute 1st root and store in variable x1 using the formula
x1 = (-b + (d)½)/(-2a) and the other root in variable x2 using the formula
½)
x2= (-b - (d) /(-2a)
5. Print the values of the real roots x1 and x2 as the roots of the equation. goto step 11
6. Check if the value of d is less than 0. If it is, goto step 7 otherwise goto step 11
7. Compute the real part of the root and store in x1 using the formula
x1=-b/2a and the complex part in x2 using the formula
x2 = (-d)½/2a
8. Print the value of the complex roots onto the screen as x1 + ix2 and x1-ix2. Goto step 11.
9. Compute the equal roots and store in variables x1 and x2 using the formula
x1 = -b/2a and x2 = -b/2a
10. Print the values of the equal roots x1 and x2 onto the screen.
11. Stop.

Sample Output
ENTER THE COEFFIECIENTS
ENTER THE VALUE OF a: 2
ENTER THE VALUE OF b: 7
ENTER THE VALUE OF c: 4
THE ROOTS ARE -0.72,-2.78

THE ROOTS ARE REAL AND DISTINCT

ENTER THE COEFFIECIENTS


ENTER THE VALUE OF a: 1
ENTER THE VALUE OF b: 2
ENTER THE VALUE OF c: 1
THE ROOTS ARE -1.00,-1.00

THE ROOTS ARE REAL AND EQUAL

ENTER THE COEFFIECIENTS


ENTER THE VALUE OF a: 1
ENTER THE VALUE OF b: 2
ENTER THE VALUE OF c: 5
THE ROOTS ARE -1.00+2.00i AND -1.00-2.00i

THE ROOTS ARE COMPLEX


Ex no: 9c

Armstrong Number

Aim

To write a program to check whether the given number is Armstrong or not.

Algorithm Description

1. Start.
2. Accept the number, N
3. Find the sum of the cube of the individual digits of the number N and store
in SUM1.
4. If SUM1 equals to N then N is Armstrong Else N is not Armstrong.
5. Stop

Sample Output
ENTER THE NUMBER: 153
THE GIVEN NUMBER 153 IS AN ARMSTRONG NUMBER

ENTER THE NUMBER: 345


THE GIVEN NUMBER 345 IS NOT AN ARMSTRONG NUMBER
Ex no: 9d

Palindrome Number

Aim

To write a program to check whether the given number is Armstrong or not.

Algorithm Description

1. Start.
2. Accept the number, N
3. Find the reverse of the number N by extracting the last digit, multiplying by 10 and
reducing the number
4. If the reverse equals to N then N is a Palindrome Else N is not Palindrome.
5. Stop

Sample Output
ENTER THE NUMBER: 121
THE GIVEN NUMBER 121 IS A PALINDROME NUMBER

ENTER THE NUMBER: 345


THE GIVEN NUMBER 345 IS NOT A PALINDROME NUMBER
Ex no: 9e

Electricity bill Preparation

Aim

To write a C program to calculate electricity bill. Read the starting and ending meter reading.
The charges are as follows.

No of units consumed Rates in (Rs)


200.500 3.50
100.200 2.50
Less than 100 1.50

Algorithm Description

1. Get the initial and final meter reading from the consumer card.
2. No of units consumed=final meter reading-initial meter reading
3. If (no of units consumed >=200 && no of units consumed <=500) then
total charge =No of units consumed*3.50
4. If (no of units consumed >=100 && no of units consumed <=199) then
total charge =No of units consumed*2.50
5. If(no of units consumed <100) then total charge =No of units consumed*1.50
6. Print the total charge for the calculated no of units consumed.

Sample Output

Enter the initial and final meter reading:


3000
3050

No of units consumed=50
Total charge(Rs)=75
Ex no: 9f

Menu driven calculator

Aim

To write a simple menu driven calculator program using switch statement

Algorithm Description

1. Get two operands and the operator character from the user.
2. If the operator is ‘+’ then add the operands.
3. If the operator is ‘-’ then subtract one operand from the other operand.
4. If the operator is ‘*’ then multiply the operands
5. If the operator is ‘/’ then divide one operand by the other.
6. If the entered character is not matching any of these above four operators then print the
default statement “Enter the correct operator”

Sample Output

Enter the operands


3
5
Enter the operator
+

8
Ex no: 9g

To find the largest digit in a number


Aim

To find the sum of odd-positioned and even-positioned digits of a number

Algorithm Description

1. Start
2. Read the value of n.
3. Assign max to 0.
4. Extract digit by digit and compare it with max.
5. Display the largest digit.
6. Stop

Sample Output:

Enter the number : 1345

Largest digit : 5
Ex no: 9h

Sine and Cosine series

Aim

To write a C program to generate the sine and cosine series


Summation of Sine series: S=x - x3 /3! + x5 /5! - x7 /7! + ………Xn /n!
Summation of Cosine series: S=1 + x2/2! + x4 /4! + x6 /6! + ………∞

Algorithm Description for Sine function

1.Get the values of x and n where n decides how long the series should continue.
2.Set the initial conditions S=x, term=x,i=1
3.To get the terms with alternate sign repeatedly execute sign=-sign
4.Till the desired no of terms are generated repeat the following steps
a. Identify the current ith term
b.generate current term from its predecessor.
current ith term = (previous term)*x2 / i*(i-1)
c.add current term with the appropriate sign to the accumulated sum for
the sine function
i=i+2
term=-term* x2 / i*(i-1)
S=S+term

Algorithm Description for Cosine function

1.Get the values of x and n.


2.Set the initial conditions S=0, term=1, i=1
3.To get the sum execute s = s + term
4.Till the desired no of terms are generated repeat the following steps
a. Identify the current ith term
b.generate current term.
current ith term = (term*x2 ) / (i+1)*(i+2)
5. Increment i by 2
i=i+2
6. Repeat Steps from 3 to 5 till (i<=n).
7. Stop
Sine Series

Sample input:

Enter the values of x and n


1
2

Sample output
0.8333333

Cosine Series

Sample input:

Enter the values of x and n


2
2

Sample output
4
Ex no: 9i

Prime Number Generation


Aim

To generate a prime number series upto the given limit.

Algorithm Description

1. Start
2. Read the value of n.
3. To print the value 2 on screen.
4. Make a for loop
Declare i=3
Increment i by 1 upto n
5. Using another for loop
Declare j=2
From j=2 to j<i; divide i by j
If i % j = = 0 then print the number else print (“ “)
6. Stop

Sample Output:

Enter the Limit value : 10

2
3
5
7
Ex no: 10a

Linear Search

Aim

To search for a given element in an array and find its position if it is present.

Algorithm Description

1. Start
2. Accept the number of elements, n
3. Read all the n elements in the array a[n]
4. Accept the element, s, to search.
5. Initialize variables big and small to a[0] and posn to –1.
6. For i = 0 to n-1 do step 7
7. if (s==a(i)) then posn = i
8. if (posn>-1) then print “The given element is found at position :” , posn
9. if (posn==-1) then print “The given element is not found in the array”
10. Stop

Sample Output

Enter No of elements: 3
Enter Array elements: 2,6,9
Enter Searching element: 6

The given element is found at position :2.


Ex no: 10b

Bubble Sort
Aim

To sort the elements of an array using bubble sort.

Algorithm Description

1. Start
2. Accept the number of elements, n, in the array.
3. For i = 0 to n-1 do step 4
4. Read a(i)
5. For i = 0 to n-1 do steps 6 to 10
6. For j = 0 to n-i-1 steps 7 to 10
7. if (a(j)>a(j+1)) do steps 8 to 10
8. temp = a(j)
9. a(j) = a(j+1)
10. a(j+1) = temp
11. For i = 0 to n-1 do step 12
12. Write a(i)
13. Stop

Sample Output

Enter No of Array Elements: 4


Enter Array Elements: 4,2,10,6

After Sorting:
2
4
6
10
Ex no: 10c

Matrix Addition
Aim

To write a program in C to perform matrix addition.

Algorithm Description

1. Start.
2. Accept the number of rows and columns (m,n , p,q) for the 2 matrices a & b.
3. If m<>p && n<>q then write “Matrix addition is not possible.” goto Step 13.
4. Accept the elements of the 2 matrices.
5. Repeat Steps 5 to 8 for i = 1 to m.
6. Repeat Steps 6 to 7 for j = 1 to q.
7. c[i][j]=a[i][j]+b[i][j]
8. Continue looping for j.
9. Continue looping for i.
10. Display “ The resultant matrix is”
11. Display the matrix c.
12. Stop.

Sample Output

Enter number of rows& columns in 1st matrix: 3 3


Enter number of rows& columns in 2nd matrix: 3 3
Enter the elements of the 1st matrix:
123
456
789
Enter the elements in the 2nd matrix:
100
010
001
The matrix after addition is
223
466
7 8 10
Ex no: 10d

Matrix Multiplication
Aim

To write a program in C to perform matrix multiplication.

Algorithm Description

1. Start.
2. Accept the number of rows and columns (m,n , p,q) for the 2 matrices a & b.
3. If n<>p then write “Matrix multiplication is not possible.” And goto Step 14.
4. Accept the elements of the 2 matrices.
5. Repeat Steps 6 to 11 for i = 1 to m.
6. Repeat Steps 7 to 10 for j = 1 to q.
7. Repeat Steps 8 & 9 for k = 1 to n.
8. c[i][j]=c[i][j]+a[i][k]* b[k][j].
9. Continue looping for k.
10. Continue looping for j.
11. Continue looping for i.
12. Display “ The resultant matrix is”
13. Display the matrix c.
14. Stop.

Sample Output

Enter number of rows& columns in 1st matrix: 3 3


Enter number of rows& columns in 2nd matrix: 3 3
Enter the elements of the 1st matrix:
123
456
789
Enter the elements in the 2nd matrix:
100
010
001
The matrix after multiplication is
123
456
789
Ex no: 10e

Display the matrix with the sum of 3 rows and columns


Aim

To write a program in C to input a 3x3 Matrix and display a Matrix with the sum of the rows and
columns.

Algorithm Description

1. Start.
2. Input the elements of the matrix
3. Find the row wise and column wise total and store it in separate one-dimensional
matrices
4. Display the given matrix along with the two one dimensional matrices in the required
format.
5. Stop.

Sample Output

Enter the elements of the matrix:


123
456
789
The resultant matrix is
1 2 3 6
4 5 6 15
7 8 9 24
12 15 18
Ex no: 10f
String Manipulation
Aim

To write a program in C to perform string manipulation function like string concatenations,


comparison, find the length and string copy without using library functions.

Algorithm Description

1. Start.
2. Enter the two strings ,s1 and s2
3. Display the menu
1. String Concatenation
2. String Comparison
3. String length
4. String Copy
4. Accept the choice, ch from the user
5. if ch==1 goto step 6 else goto step 13
6. for i=0 to s1[i]<>’\0’ do step 7
7. concat[i]=s1[i]
8. concat[i]=’ ‘
9. for j=0 to s2[j]<>’\0’ do step 10
10. concat[i+j+1]=s2[j]
11. concat[i+j+1]=’\0‘
12. print the concatenated string as concat
13. if ch==2 goto 14 else goto step 20
14. initialize i=0
15. while(s1[i]==s2[i] && s1[i]<>’\0’&& s2[i]<>’\0’) do step 16
16. increment i by 1
17. if s1[i]==’\0’ && s2[i]==’\0’) do step 18
18. print the strings are equal
19. else print not equal
20. if ch==3 goto 21 else goto step 25
21. initialize count=0,i=0
22. while s1[i]<>’\0’do step 23
23. increment count by 1 and i by 1
24. display the length of the string as count –1
25. for i=0 to s1[i]<>’\0’ do step 26
26. copy[i]=s1[i]
27. copy[i]=’\0’
28. display the copied string as copy
Sample Output
Enter the two strings
New
York
1. String Concatenation
2. String Comparison
3. String length
4. String Copy

Enter the choice :1


Concatentated String : New York

1. String Concatenation
2. String Comparison
3. String length
4. String Copy

Enter the choice :2


String Comparison : Strings are not equal

1. String Concatenation
2. String Comparison
3. String length
4. String Copy

Enter the choice :3


st
Length of the 1 string : 3

1. String Concatenation
2. String Comparison
3. String length
4. String Copy

Enter the choice :4


Copied String : New
Ex no: 10g

Sorting Of Names
Aim

To write a program in C to arrange names in alphabetical order

Algorithm Description

1. Start.
2. Accept the number of names, n, in the array.
3. For i = 0 to n-1 do step 4
4. Read a(i)
5. For i = 0 to n-1 do steps 6 to 10
6. For j = 0 to n-i-1 steps 7 to 10
7. if (strcmp(a(j),a(j+1)) >0) do steps 8 to 10
8. strcpy(temp, a(j))
9. strcpy(a(j) , a(j+1))
10. strcpy(a(j+1) , temp)
11. For i = 0 to n-1 do step 12
12. Write a(i)
13. Stop

Sample Output

Enter the number of names : 4


London
Delhi
Paris
Moscow

Alphabetical List
Delhi
London
Moscow
Paris
Ex no: 11a

Student’s Mark list using Structures


Aim

To write a program in C to maintain the student’s mark list.

Algorithm Description

1. Start
2. Define a structure stu containing members like name, roll number, mark1,
mark2, mark3, total, average & grade with structure variable name
s[100](array of structures).
3. Accept the number of students n.
4. Accept the details of the students by accessing the members of the structure by
giving s[i].<member name> where I is the loop counter from 1 to n.
5. Repeat steps 6 to 8 for i=1 to n.
6. Compute s[i].total by summing the 3 marks and the average for the ith student.
7. Depending on the value of average, compute the grade for the ith student.
8. Continue looping for i.
9. Display the details of the students in tabular format.
10. Stop.

Sample Output

Enter the number of students: 2


Enter details….
1.
ROLL NO.: 22
NAME: san
MATHS MARKS: 100
PHY MARKS: 99
CHEM MARKS: 88
2.
ROLL NO.: 12
NAME: wer
MATHS MARKS: 88
PHY MARKS: 22
CHEM MARKS: 33

Student Details
ROLL NO NAME TOTAL AVG. GRADE
22 san 287 95 A
12 wer 143 47 C
Ex no: 11b

Difference between two dates using structures.


Aim

To write a program in C for finding the difference between two dates using structures.
.

Algorithm Description

1. Start
2. Define a structure date containing members like day, month, year.
3. Define 3 structure variables for date, say, d1, d2 and d3.
4. Accept the details of the dates for d1 and d2 by accessing the members of the structure
using d.<member name>
5. Find the difference and store it in d3.
6. Stop.

Sample Output

Enter date1: 18
04
2010
Enter date2: 12
02
2010
Difference in days: 6
Difference in Months: 2
Difference in year: 0
Ex no: 11c

Employee Payroll using Unions


Aim

To write a program in C to prepare Employee Payroll.

Algorithm Description

1. Start
2. Define a union emp containing members like name,
emp id,bpay,DA,HRA,CCA,PF,grosspay & netpay with union variable name
e[100](array of unions).
3. Accept the number of employees n.
4. Accept the details of the employees by accessing the members of the union by
giving e[i].<member name> where I is the loop counter from 1 to n.
5. Repeat steps 6 to 8 for i=1 to n.
6. Compute e[i].DA ,e[i] .HRA, e[i] .CCA ,e[i] .PF for the ith employee.
7. Compute e[i].gross by summing the above four calculations for the ith
employee.
8. Compute e[i].netpay by subtracting the PF from gross for the ith employee.
9. Continue looping for i.
10. Display the details of the employees in tabular format.
11. Stop.

Sample Output

Enter the number of employees: 2


Enter details….
1.
EMP ID: 133
NAME: RASAN
BASIC PAY: 8000
2.
EMP ID: 135
NAME: RAVI
BASIC PAY: 6000

Employee Details

EMP ID NAME BASIC PAY DA HRA CCA PF GROSS NET


22 RASAN 8000 5680 800 400 800 15680 14880
12 RAVI 6000 4260 600 300 600 11760 11160
Ex no: 12a

Calculation of mean, variance and standard deviation using


functions

Aim

To write a C program to calculate the mean, variance and standard deviation using functions.

Algorithm Description

1. Start.
2. Enter the number of elements, n
3. Store the elements in an array, a[i]
4. call the function,mean(a,n) to calculate the mean
5. call the function, variance(a,n) to calculate the variance
6. square root of variance is the Standard deviation, sd=sqrt(variance)
7. Display mean, variance and standard deviation
8. Stop

Function mean(a,n)
1. Start
2. initialize sum=0
3. for i=1 to n do step 4
4. sum=sum+a[i]
5. m=sum/n
6. return m
7. stop

Function variance(a,n)
1. Start
2. x=mean(a,n)
3. for i=0 to n do step
4. sum=sum+(a[i]-x)*(a[i]-x)
5. var=sum/n
6. return var
7. Stop

Sample Output

Enter the limit:5


Enter the elements: 3 4 5 6 7
Mean: 5
Variance :2
Standard Deviation:1.414
Ex no: 12b

Sequential and Binary search using Functions


Aim

To write a program in C to perform sequential and binary search using functions

Algorithm Description

1. Start.
2. Accept the limit ,n
3. Read all the n elements in the array a[n]
4. Accept the element, s, to search.
5. call the function, seq(a,s,n) for sequential search
6. call the function, bin(a,s,n) for binary search
7. Stop

Function seq(a,s,n)
1. Start
2. Initialize variables big and small to a[0] and posn to –1 respectively.
3. For i = 0 to n-1 do step 4
4. if (s==a(i)) then posn = i
5. if (posn>-1) then print “The given element is found at position :” , posn
6. if (posn==-1) then print “The given element is not found in the array”
7. Stop

Function bin(a,s,n)
1. Start
2. Initialize left=0 right =n
3. while left<=right do step 4
4. mid=floor((right-left)/2)+left
5. if value > a[mid] ,left=mid +1
6. else if value < a[mid], right=mid-1
7. else return mid
8. else return not found
9. Stop

Sample Output

Enter No of elements: 3
Enter Array elements: 2,6,9
Enter Searching element: 6

The given element is found at position :2.


Ex no: 12c

Fibonacci series using recursion


Aim

To write a program in C to print the fibonacci series using recursion

Algorithm Description

1. Start.
2. Accept the limit ,n
3. call the function, fib(n)
4. Print the series
5. Stop

Function fib(n)

1. Start
2. if n==1 return 0
3. else if n==2 return 1
4. else f(n)=fib(n-1)+fib(n-2)
5. return f(n)
6. Stop

Sample Output

Enter the limit:4


Fibonacci series:
0
1
1
2
Ex no: 12d

Factorial of the given number using recursion

Aim

To write a program in C to calculate factorial of the given number using functions

Algorithm Description

1. Start
2. Enter the number,n for which the factorial has to be calculated
3. call the function, fact(n)
4. Print the factorial of the number
5. Stop

Function fact(n)

1. Start
2. if n==1 return 1
3. else f=n*fact(n-1)
4. return f
5. Stop

Sample Output

Enter the number: 4


Factorial : 24

You might also like