GE2115-Computer Practice Laboratory-I Manual-rev01

83
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 Signatur e Name Ms. P. Sharon Femi Ms. L. Anita Elizabeth Dr .G.Sumathi Designat Assistant Professor HOD-IT 1

Transcript of GE2115-Computer Practice Laboratory-I Manual-rev01

Page 1: GE2115-Computer Practice Laboratory-I Manual-rev01

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 FemiMs. L. Anita Elizabeth Dr .G.Sumathi

Designation Assistant Professor HOD-ITDate 19.08.2010 19.08.2010

1

Page 2: GE2115-Computer Practice Laboratory-I Manual-rev01

TABLE OF CONTENTS

Exercise No Exercise Name

1Word Processing Document creation, Text manipulation with Scientific notations.

2Word Processing

a. Table creation, Table formatting and Conversionb. To create an advertisement in Word.

3Word ProcessingTo illustrate the concept of mail merging and letter preparation.

4Word ProcessingDrawing - flow Chart

5Spread sheetChart - Line, XY, Bar and Pie.

6Spread sheetFormula - formula editor.

7Spread sheetInclusion of object, Picture and graphics, protecting the document and sheet. Auto Filtering

8Spread sheetSorting and Import / Export features.

9

Data types, Expression Evaluation, Condition Statements.

a. Round of an integerb. Quadratic equationc. Armstrong number d. Palindrome Numbere. To write a program for electricity bill preparation.f. To write a simple menu driven calculator program using switch statementg. To write a program to find the largest digit of a

numberh. To write a program to print the sine and cosine

series.i. To write a program to generate prime numbers.

2

Page 3: GE2115-Computer Practice Laboratory-I Manual-rev01

TABLE OF CONTENTS

3

Exercise No Exercise Name

10

Arrays

a. Linear Searchb. Bubble sort c. Matrix additiond. To write a program to perform Matrix

multiplication.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

11

Structures and Unions

a. To print the mark sheet of n students using structures.

b. To print the difference between two dates using structures

c. To print the employee payroll using unions.

12

Functionsa. 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

binary search using functionsc. To write a program to print the Fibonacci

series using recursiond. To calculate the factorial of the given number

using recursion

Page 4: GE2115-Computer Practice Laboratory-I Manual-rev01

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

Page 5: GE2115-Computer Practice Laboratory-I Manual-rev01

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

xvi. Undo the above action and see the effect

5

Page 6: GE2115-Computer Practice Laboratory-I Manual-rev01

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: justifiedIndentation: 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

Highlight the statement, right click the mouse button, select copy (or) select copy from ‘edit’

6

Page 7: GE2115-Computer Practice Laboratory-I Manual-rev01

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 Salary1 E001 Aditi 31/9,Dr.Mukherjee Nagar 40002 E002 Bharti 1292, Jawahar Colony 30003 E003 Pradeep 19/12,Dr.Mukherjee Nagar 30504 E004 Arora A-91,Jawahar Colony 80005 E005 Narula 63/2,Patel Nagar 40006 E006 Kaur 72/9,Outram Lines 20507 E007 Savita 19/AZ, Dr.Mukherjee Nagar 30508 E008 Gaurav A6/212,Panchakula 67509 E009 Avneet 101/B6,Outerm lines 500010 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

Page 8: GE2115-Computer Practice Laboratory-I Manual-rev01

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 NagarPreeti Ahuja 1457896 A-E/269,Shalimar BaghMeenu Kataria 3205623 B-P/81,B.P.ColonyMandeep Kaur 4579681 25/K9,Outram LinesTeena 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

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

8

Page 9: GE2115-Computer Practice Laboratory-I Manual-rev01

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 PolymersII. V & A Vicky & Associates

III. BPL British Petroleum LimitedIV. PACE PACE Academy of Computer EducationV. 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 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.

9

Page 10: GE2115-Computer Practice Laboratory-I Manual-rev01

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

Page 11: GE2115-Computer Practice Laboratory-I Manual-rev01

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 LinesTeena 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.

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.

11

Page 12: GE2115-Computer Practice Laboratory-I Manual-rev01

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

12345

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. 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.

12

Page 13: GE2115-Computer Practice Laboratory-I Manual-rev01

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. 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.

13

Page 14: GE2115-Computer Practice Laboratory-I Manual-rev01

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

Page 15: GE2115-Computer Practice Laboratory-I Manual-rev01

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 Outsourcing Center and Wipro Technologies indicates companies still have significant challenges in managing their captive offshore centers.

The survey, which was not a scientific study, polled visitors at the Outsourcing Center portal during May 2006. It asked CIOs and Global Sourcing Managers to choose which of the following four factors is their key challenge in managing an offshore captive center:

•Rapid scalability of workforce and infrastructure while maintaining the cost advantage

•Aligning the offshore team with your organization’s culture and business imperatives•Lack of a long-term strategy or vision for your captive offshore operation•Lack of adequate management bandwidth to effectively manage the model

This discusses the survey’s findings as well as some best practices to combat the challenges of a captive offshore center. It also discusses the trend of using a hybrid model— part captive, part outsourcing—as the solution for these challenges.

15

Page 16: GE2115-Computer Practice Laboratory-I Manual-rev01

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.

Page 17: GE2115-Computer Practice Laboratory-I Manual-rev01

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.

Page 18: GE2115-Computer Practice Laboratory-I Manual-rev01

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.

Page 19: GE2115-Computer Practice Laboratory-I Manual-rev01

Ex no: 4

Drawing Flowcharts

1.Draw a flowchart to find the sum of first 50 natural numbers2.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.

Page 20: GE2115-Computer Practice Laboratory-I Manual-rev01

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)

Page 21: GE2115-Computer Practice Laboratory-I Manual-rev01

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 FLOWCHARTS1. 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 made4. Efficient Coding are developed5. 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:

Page 22: GE2115-Computer Practice Laboratory-I Manual-rev01

Exercises On Flowcharting:

Page 23: GE2115-Computer Practice Laboratory-I Manual-rev01

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

Page 24: GE2115-Computer Practice Laboratory-I Manual-rev01

2. Draw a flowchart to find the largest of three numbers A,B, and C.

Page 25: GE2115-Computer Practice Laboratory-I Manual-rev01

3. Draw a flowchart for computing factorial N (N!)

Where N! = 1 ´ 2 ´ 3 ´ …… N .

Page 26: GE2115-Computer Practice Laboratory-I Manual-rev01

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 E1 Vehicle Jan Feb Mar Total2 Car 250 300 3103 Auto 54 92 204 Jeep 91 120 115 Van 125 119 786 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.

Page 27: GE2115-Computer Practice Laboratory-I Manual-rev01

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.

Page 28: GE2115-Computer Practice Laboratory-I Manual-rev01

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.

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.

Page 29: GE2115-Computer Practice Laboratory-I Manual-rev01

6. Type the following data in column F

F1 Cost2 2000003 7000004 9000005 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.

Page 30: GE2115-Computer Practice Laboratory-I Manual-rev01

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

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

Page 31: GE2115-Computer Practice Laboratory-I Manual-rev01

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

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.

Page 32: GE2115-Computer Practice Laboratory-I Manual-rev01

Ex no: 6

Formula - Formula editorPROBLEM 1:

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

A B C D E1 GLOBAL SOFT COMPANY2 Emp No. Name Salary3 1 Meena 245004 2 Vishal 105005 3 Elisa 147906 4 Richa 140007 5 Swetha 152508 6 Dravid 160009 7 Sourav 1410010

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 salaryDA - 28% of basic salaryPF - 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.

Page 33: GE2115-Computer Practice Laboratory-I Manual-rev01

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 E1

HINDUSTAN DEPARTMENTAL STORE

2 Item Name Original Price Discount(%)

Selling Price

3 Ponds 98 104 Vicco 88 85 Lakmi 102 96 Farex 300 127 Denim 500 158 Biotiq 400 109

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

Page 34: GE2115-Computer Practice Laboratory-I Manual-rev01

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.

Page 35: GE2115-Computer Practice Laboratory-I Manual-rev01

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

Page 36: GE2115-Computer Practice Laboratory-I Manual-rev01

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.

Page 37: GE2115-Computer Practice Laboratory-I Manual-rev01

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 buttonExcel 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.

Page 38: GE2115-Computer Practice Laboratory-I Manual-rev01

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)j3. Print the value of variable k onto the screen.4. Stop.

Sample Output

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

ENTER THE INTEGER TO BE RONDED OFF: 57ENTER THE ANOTHER INTEGER: 8THE RONDED OFF INTEGER IS 64

Page 39: GE2115-Computer Practice Laboratory-I Manual-rev01

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 64. Compute 1st root and store in variable x1 using the formula

x1 = (-b + (d)½)/(-2a) and the other root in variable x2 using the formulax2= (-b - (d)½)/(-2a)

5. Print the values of the real roots x1 and x2 as the roots of the equation. goto step 116. 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 formulax2 = (-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/2a10. Print the values of the equal roots x1 and x2 onto the screen.11. Stop.

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

THE ROOTS ARE REAL AND DISTINCT

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

THE ROOTS ARE REAL AND EQUAL

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

THE ROOTS ARE COMPLEX

Page 40: GE2115-Computer Practice Laboratory-I Manual-rev01

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: 153THE GIVEN NUMBER 153 IS AN ARMSTRONG NUMBER

ENTER THE NUMBER: 345THE GIVEN NUMBER 345 IS NOT AN ARMSTRONG NUMBER

Page 41: GE2115-Computer Practice Laboratory-I Manual-rev01

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, N3. 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: 121THE GIVEN NUMBER 121 IS A PALINDROME NUMBER

ENTER THE NUMBER: 345THE GIVEN NUMBER 345 IS NOT A PALINDROME NUMBER

Page 42: GE2115-Computer Practice Laboratory-I Manual-rev01

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.50100-200 2.50Less 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 reading3. If (no of units consumed >=200 && no of units consumed <=500) then

total charge =No of units consumed*3.504. If (no of units consumed >=100 && no of units consumed <=199) then

total charge =No of units consumed*2.505. If(no of units consumed <100) then total charge =No of units consumed*1.506. 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=50Total charge(Rs)=75

Page 43: GE2115-Computer Practice Laboratory-I Manual-rev01

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 operands5. 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 operands35Enter the operator +

8

Page 44: GE2115-Computer Practice Laboratory-I Manual-rev01

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. Start2. 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

Page 45: GE2115-Computer Practice Laboratory-I Manual-rev01

Ex no: 9h

Sine and Cosine series

Aim

To write a C program to generate the sine and cosine seriesSummation 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=13.To get the terms with alternate sign repeatedly execute sign=-sign4.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=13.To get the sum execute s = s + term4.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

Page 46: GE2115-Computer Practice Laboratory-I Manual-rev01

Sine Series

Sample input:

Enter the values of x and n12

Sample output0.8333333

Cosine Series

Sample input:

Enter the values of x and n22

Sample output4

Page 47: GE2115-Computer Practice Laboratory-I Manual-rev01

Ex no: 9i

Prime Number Generation

Aim

To generate a prime number series upto the given limit.

Algorithm Description

1. Start2. Read the value of n.3. To print the value 2 on screen.4. Make a for loop

Declare i=3Increment i by 1 upto n

5. Using another for loopDeclare j=2From 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

2357

Page 48: GE2115-Computer Practice Laboratory-I Manual-rev01

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. Start2. Accept the number of elements, n3. 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 :” , posn9. if (posn==-1) then print “The given element is not found in the array”10. Stop

Sample Output

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

The given element is found at position :2.

Page 49: GE2115-Computer Practice Laboratory-I Manual-rev01

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 106. For j = 0 to n-i-1 steps 7 to 10 7. if (a(j)>a(j+1)) do steps 8 to 108. temp = a(j)9. a(j) = a(j+1)10. a(j+1) = temp11. For i = 0 to n-1 do step 1212. Write a(i)13. Stop

Sample Output

Enter No of Array Elements: 4Enter Array Elements: 4,2,10,6

After Sorting: 24610

Page 50: GE2115-Computer Practice Laboratory-I Manual-rev01

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 3Enter number of rows& columns in 2nd matrix: 3 3Enter the elements of the 1st matrix:1 2 34 5 67 8 9Enter the elements in the 2nd matrix:1 0 00 1 00 0 1The matrix after addition is2 2 34 6 67 8 10

Page 51: GE2115-Computer Practice Laboratory-I Manual-rev01

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 3Enter number of rows& columns in 2nd matrix: 3 3Enter the elements of the 1st matrix:1 2 34 5 67 8 9Enter the elements in the 2nd matrix:1 0 00 1 00 0 1The matrix after multiplication is1 2 34 5 6 7 8 9

Page 52: GE2115-Computer Practice Laboratory-I Manual-rev01

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 matrix3. Find the row wise and column wise total and store it in separate one-dimensional

matrices4. 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:1 2 34 5 67 8 9The resultant matrix is1 2 3 64 5 6 157 8 9 2412 15 18

Page 53: GE2115-Computer Practice Laboratory-I Manual-rev01

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 s23. Display the menu

1. String Concatenation2. String Comparison3. String length4. String Copy

4. Accept the choice, ch from the user5. if ch==1 goto step 6 else goto step 136. for i=0 to s1[i]<>’\0’ do step 77. concat[i]=s1[i]8. concat[i]=’ ‘9. for j=0 to s2[j]<>’\0’ do step 1010. concat[i+j+1]=s2[j]11. concat[i+j+1]=’\0‘12. print the concatenated string as concat13. if ch==2 goto 14 else goto step 2014. initialize i=015. while(s1[i]==s2[i] && s1[i]<>’\0’&& s2[i]<>’\0’) do step 16 16. increment i by 117. if s1[i]==’\0’ && s2[i]==’\0’) do step 1818. print the strings are equal19. else print not equal20. if ch==3 goto 21 else goto step 2521. initialize count=0,i=022. while s1[i]<>’\0’do step 2323. increment count by 1 and i by 124. display the length of the string as count –125. for i=0 to s1[i]<>’\0’ do step 2626. copy[i]=s1[i]27. copy[i]=’\0’28. display the copied string as copy

Page 54: GE2115-Computer Practice Laboratory-I Manual-rev01

Sample OutputEnter the two stringsNew York

1. String Concatenation2. String Comparison3. String length4. String Copy

Enter the choice : 1Concatentated String : New York

1. String Concatenation2. String Comparison3. String length4. String Copy

Enter the choice : 2String Comparison : Strings are not equal

1. String Concatenation2. String Comparison3. String length4. String Copy

Enter the choice : 3Length of the 1st string : 3

1. String Concatenation2. String Comparison3. String length4. String Copy

Enter the choice : 4Copied String : New

Page 55: GE2115-Computer Practice Laboratory-I Manual-rev01

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 106. For j = 0 to n-i-1 steps 7 to 10 7. if (strcmp(a(j),a(j+1)) >0) do steps 8 to 108. 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 1212. Write a(i)13. Stop

Sample Output

Enter the number of names : 4LondonDelhiParisMoscow

Alphabetical ListDelhiLondonMoscowParis

Page 56: GE2115-Computer Practice Laboratory-I Manual-rev01

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: 2Enter details….1.ROLL NO.: 22NAME: sanMATHS MARKS: 100PHY MARKS: 99CHEM MARKS: 882.ROLL NO.: 12NAME: werMATHS MARKS: 88PHY MARKS: 22CHEM MARKS: 33

Student DetailsROLL NO NAME TOTAL AVG. GRADE22 san 287 95 A12 wer 143 47 C

Page 57: GE2115-Computer Practice Laboratory-I Manual-rev01

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: 18042010Enter date2: 12022010Difference in days: 6Difference in Months: 2Difference in year: 0

Page 58: GE2115-Computer Practice Laboratory-I Manual-rev01

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: 2Enter details….1.EMP ID: 133NAME: RASANBASIC PAY: 80002.EMP ID: 135NAME: RAVIBASIC PAY: 6000

Employee Details

EMP ID NAME BASIC PAY DA HRA CCA PF GROSS NET22 RASAN 8000 5680 800 400 800 15680 1488012 RAVI 6000 4260 600 300 600 11760 11160

Page 59: GE2115-Computer Practice Laboratory-I Manual-rev01

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, n3. Store the elements in an array, a[i]4. call the function,mean(a,n) to calculate the mean5. call the function, variance(a,n) to calculate the variance6. square root of variance is the Standard deviation, sd=sqrt(variance)7. Display mean, variance and standard deviation8. Stop

Function mean(a,n)1. Start2. initialize sum=03. for i=1 to n do step 44. sum=sum+a[i]5. m=sum/n6. return m7. stop

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

Sample Output

Enter the limit:5Enter the elements: 3 4 5 6 7Mean: 5Variance :2Standard Deviation:1.414

Page 60: GE2115-Computer Practice Laboratory-I Manual-rev01

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 ,n3. 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 search6. call the function, bin(a,s,n) for binary search7. Stop

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

Function bin(a,s,n)1. Start2. Initialize left=0 right =n3. while left<=right do step 44. mid=floor((right-left)/2)+left5. if value > a[mid] ,left=mid +16. else if value < a[mid], right=mid-17. else return mid8. else return not found9. Stop

Sample Output

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

The given element is found at position :2.

Page 61: GE2115-Computer Practice Laboratory-I Manual-rev01

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 ,n3. call the function, fib(n)4. Print the series5. Stop

Function fib(n)

1. Start2. if n==1 return 03. 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:4Fibonacci series:0112

Page 62: GE2115-Computer Practice Laboratory-I Manual-rev01

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. Start2. Enter the number,n for which the factorial has to be calculated3. call the function, fact(n)4. Print the factorial of the number5. Stop

Function fact(n)

1. Start2. if n==1 return 13. else f=n*fact(n-1)4. return f5. Stop

Sample Output

Enter the number: 4Factorial : 24