0% found this document useful (0 votes)
156 views

GE2115 Computer Practice Laboratory - I List of Exercises A) Word Processing

This document outlines exercises for a computer practice laboratory course, including: 1) Word processing exercises like document creation, formatting text, tables, mail merge and flow charts. 2) Spreadsheet exercises involving charts, formulas, formatting, sorting and importing/exporting. 3) Basic C programming exercises on data types, arrays, structures, unions and functions. Flow charts and pseudo code are required for programming exercises. Specific examples provided include adding matrices, string operations, student details, recursion and function arguments/returns.

Uploaded by

cvaravind
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
156 views

GE2115 Computer Practice Laboratory - I List of Exercises A) Word Processing

This document outlines exercises for a computer practice laboratory course, including: 1) Word processing exercises like document creation, formatting text, tables, mail merge and flow charts. 2) Spreadsheet exercises involving charts, formulas, formatting, sorting and importing/exporting. 3) Basic C programming exercises on data types, arrays, structures, unions and functions. Flow charts and pseudo code are required for programming exercises. Specific examples provided include adding matrices, string operations, student details, recursion and function arguments/returns.

Uploaded by

cvaravind
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 44

GE2115-COMPUTER PRACTICE LABORATORY-I

GE2115 COMPUTER PRACTICE LABORATORY – I

LIST OF EXERCISES

a) Word Processing

1. Document creation, Text manipulation with Scientific notations.

2. Table creation, Table formatting and Conversion.

3. Mail merge and Letter preparation.

4. Drawing - flow Chart

b) Spread Sheet

5. Chart - Line, XY, Bar and Pie.

6. Formula - formula editor.

7. Spread sheet - inclusion of object, Picture and graphics, protecting the document     and sheet.

8. Sorting and Import / Export features.

Simple C Programming *

9. Data types, Expression Evaluation, Condition Statements.

10. Arrays

11. Structures and Unions

12. Functions

* For programming exercises Flow chart and pseudo code are essential

No Page
Title No:

10A ARRAYS
Program to add two matrices 45
10B String Length And Concatenation
49
STRUCTURES AND UNIONS
11A Student Detail 51
Student Database
11B
53
FUNCTIONS
12A Recursion Using Function 56

12B Functions With Arguments And With Return Values


59

1 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Ex No: 1 Document Creation, Text manipulation With


Scientific Notation
Aim: To create a new document and to perform some text manipulation along with scientific
notation.

Procedure:
Step 1: Open a new document and perform the following tasks:
 Open a new document using File New option and type the text.
 For justification select the entire text of the document and press Ctrl + J or select the justify
button on the formatting tool bar.
 For Bold face of the words, select the word you want to change and press Ctrl + B or select
the bold button on formatting tool bar.
 For spelling corrections select the word you want to correct and right click and select auto
correct and select the needed correct word.
 Select the text you want to make Italic style then press Ctrl + I click the Italic button on the
formatting tool bar.
 Select the text, which you want underline and press CTRL+ U or click on underline button
on formatting tool bar.
 For saving the document, press Ctrl +S or click on save button on Standard tool bar or
select the Save option from the File menu. Choose a suitable file name in the File menu.
Then it shows the Save As dialog box. Choose a suitable file name in File Name Text Box,
then click Save button on Save As dialog Box. Now the document is saved under a given
name.

Step 2: Alignment

Select the text for alignment.

 For Left Alignment press Ctrl + L or press Align Left Button on the formatting toolbar.

 For Center Alignment press Ctrl + E or press Center button on the formatting tool bar.
 For Right Alignment press Ctrl +R or press Align Right Button on the formatting tool bar.
 For Justification press Justify button on the formatting tool bar.

Step 3: For Adding Bullets and numberings

 Select the text where you want to add Bullets and Numberings.
 Then click Bullets on the Formatting Tool Bar or choose Bullets and Numbering option
from the Format menu. It shows the Bullets and Numbering dialog box.
 Choose the required Bullet from the Bullet Tab for Bullets.
 Choose Numbering Button on the Formatting tool bar or choose required number series
from the Numbered tab in the Bullets and Numbering dialog box.

Step 4: Line Spacing

 Select the paragraphs of the document using the left mouse button or Choose Select All
option from the Edit menu or by pressing Ctrl + A.

2 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

 Choose Paragraph option from the Format menu selection. A paragraph dialog box appears.
 Select the 1.5 Lines from the Line Spacing list box, and then click OK.
 Now the 1.5 line spacing is applied to the selected paragraph.

Step 5: To add box on the entire text, do the following steps

 Choose Select All option from Edit menu or by pressing Ctrl +A.
 Now the total text of the document will be highlighted.
 Click Border icon in the Formatting Tool Bar.
 Then click outside the text to de-select it. Now you will see the entire text in a box.

Step 6: Changing the different types of Font types and sizes

 Select the text you want to change for Font types and Sizes.
 Then choose Font option from the format menu.
 It shoes the Font Dialog Box.
 Choose the required Font Type from the Font drop down list box and the required Size from
the Size list box on the Font dialog box. Then click Ok.

Step 7: Inserting Symbols

 Type the text, then put the cursor where you want to add the symbol.
 Choose Symbols Option from the Insert menu.
 Shows the Symbols dialog box. Then choose the appropriate Font type.
 Then choose required symbol from the symbols dialog box. Then click Insert.

Step 8: Equations

 Enter the Equation in the document.


 Select the character, which you to show as a subscript.
 For Subscript, Choose the Font option from the Format menu, then enable the superscript
check box from the Font dialog box.
 For superscript, choose the Font option from the Format menu, then enable the superscript
check box from the Font dialog box.

Step 9: Changing text into different cases

 Select the text you want to change.


 Then choose the Change Case option from the Format Menu.
 The Change Case dialog box appears. Here we can choose the different cases.

Step 10: For Document Creation

 Type the heading in the document. Then choose the appropriate Font Type and Size.
 Put the heading in Center Alignment
 Type the required text for adding bullets.
 Choose Bullets and Numbering option from the format menu.
 Choose Book type bullets from the Webdings font type.

3 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

 Then click Ok push button.


 Then enter the next text and choose the appropriate font type and size.
 Enter the next text and put the underline for it.
 Then type the Address and select appropriate font type and sizes, then Align Center.

Step 11: For Typing the Formulas

 Click on Insert Object.


 Now the object dialog box will be opened.
 Choose Microsoft Equation 3.0, and then click on OK.
 Now the Microsoft Equation Toolbar appears.
 Using this toolbar we can type any equation in the document.

Step 12: To add Animation to the Text

 Type the text in the document.


 Select the text to which you want to add animation.
 Choose Format-> Font option.
 It displays the font dialog box, choose Text Effects tab.
 Choose the required one, and then click Ok.
 Now the text that is selected is in animation style.

Step 13: Visiting Card

 Open a new document.


 Click on the Page Setup option from the File Menu.
 Click on Paper Size tab, set the Width and Height and Click Ok button.
 Position the cursor and click Format-> Font and select the appropriate font type and size.
 Enter the details given such as name, phone number, E mail, Website.
 Click File-> Save.

Step 14: Advertisement

 Open a new document.


 Choose Borders and Shadings Option from the Format menu. It displays Borders and
Shadings dialog Box.
 Click on Page Border tab and choose the border style from the style drop down list, then
click Ok. Now a page border is added to the document.
 Click Insert-> Picture->WordArt Gallery dialog box.
 Note the Edit WordArt Text box is shown. Type the name of the company and click Ok.
 Click Insert->Picture-.Clip Art. Select the clip from the Insert ClipArt dialog box, which you
want insert and click Ok.
 Type briefly about the company profile.
 Type the Name of the Post, Vacancies and Qualifications as Heading.
 Click Format->Bullets and Numbering.
 Now the Bullets and Numbering dialog box is shown. Pick up an appropriate bullet style to
enter the vacancies in each category.
4 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

 Type the Name of the posts, vacancies and Qualification.


 Now the Advertisement is ready for printing.

Step 15: Letter head of the Company

 Open a new document.


 To enter a header that repeats on all pages in your document choose Header and footer.
 Now the document is changed to the view, in which the cursor is located at the headers pane.
 Enter the name of the company with big font and good style in the Header area at the top of
the page using the Format-> Font Option.
 Enter the Phone numbers, Fax numbers, e mail addresses with appropriate symbols at the
bottom of the header using the Insert->Symbols Option.
 Click Switch between Header and Footer in the Header and Footer toolbar.
 Now the cursor is moved to the footers pane of the document.
 In the footer pane enter the main products and slogans if any of the company.
 Now your company Letter pad is ready for printing.

Step 16: Curriculum Vitae

 Select Table option on the menu bar, choose Insert->Table option.


 Set Number of Columns, Number of Rows and Column Width in the Insert Table dialog box
and then click ok. The table will be created.
 Fill the appropriate data.
 Choose File->Page Set up. Switch to Margins tab if not displayed.
 Type the desired Page dimensions on the Margin Dimensions boxes.
 Change Paper Size and Orientation by switching to Paper size tab, then click Ok.
 Choose Insert ->Break->Continues from the Section break type in the Break dialog box and
click Ok.
 Choose Format->Columns, it shows the Columns dialog box, choose Two columns from the
Press box, and then click Ok.
 Type the body of the Curriculum Vitae such as Name, address, etc.
 Choose View->Header and Footer.
 Now the cursor is switched to headers pane.
 Enter your name in the Header area at the top right side of the page.
 Click the Insert -> Numbers.
 The Page Numbers dialog box is displayed.
 Click on the Position -> Bottom of Page and on Alignment -> Right.
 Now your Curriculum Vitae are ready to print.

5 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Ex No: 2 Create Table with Contents


Aim: To learn about working with table’s in Microsoft word
Procedure:
Step 1: For Table Insertion

 Chose Table->insert->table option


 It shows insert table dialog box
 Choose the required number of columns and rows
 Click OK to add table in your document
 print the text in each column
 Press TAB key to move the cursor from one cell to another
Step 2: Table
 Select table menu bar, then choose Insert table option.
 Shows Insert table dialog box
 Table dialog box and click ok.
Emp name Basic DA HRA Total salary
raja 3000 300 500 3800
kamala 6000 600 1100 7700
Grand salary 11500
Maximum 7700
Minimum 3800
 Now the table is inserted in the document with 5 columns and 4 rows.
 Enter the text in the columns by pressing leaving total salary blank
 After adding the rows. Place the cursor in the table and click Table->sort
 It shows the sort dialog box
 In the sort by option select Emp. Name from drop down list box and select Ascending
Option, and click ok.
 Place the cursor in the total salary of 2nd row. Click Table->Formula. It displays a
 Formula dialog box with Formula =SUM (LEFT) as shown below.
 Click OK. Now the total salary for the first employee is displayed at the Total
 Salary column. In the same way find total salary of remaining rows.
 Place the cursor in the total salary of last row Click Table->Insert->Rows below.
 Locate the cursor at the 4th row and 4th column, type the grand salary, press tab once,
then choose Table->Formula, in the formula dialog box type =SUM (ABOVE), now
the grand salary is displayed.
 Locate the cursor at the 5th row and 4th column, type the grand salary, press tab once,
then choose Table->Formula, in the formula dialog box type =MAX (ABOVE), now
the maximum salary is displayed.
 Locate the cursor at the 6th row and 4th column, type the grand salary, press tab once,
 then choose Table->Formula, in the formula dialog box type =MIN (ABOVE), now
the minimum salary is displayed.
Step 3: Splitting cell
 Select a cell in a table by clicking on it.

6 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

 Click table menu from the menu bar.


 select split cell option from the table menu, the split cells dialog box appears
 Enter your choice to split cells and click ok.
 Steps for merging
 Select the cells for merging in a table.
 Select the Merge cell option from the table menu, or click on Merge cells button in Tables
and Borders toolbar
 Click left mouse button and the selected cells will become one cell.
Step 4: Sorting table contents
 Insert the table and type the information
 Select the entire table and then chose Sort option from table menu.
 It shows Sort Dialog Box
 Chose column 2 for name wise sorting in the sort by list box
 Click OK
 The table contents are sorted.
Step 5: Splitting the table
 Select the row from which table is to be divided.
 Choose Split table option in the table menu. Click on it.
 Now, the table is split into two tables as shown below.
S.no Name Salary
1 Knish 5000
2 Karthi 6000

3 Krishna 4000
4 Vinay 3000
Total salary

Step5: Total salary calculation


 Insert the table and type information.
 Place the cursor in the cell at which total salary to be displayed.
 Choose Formula option from the table menu.
 Now it shows the formula dialog box with the formula [i.e. Sum (ABOVE)]
 Then click OK
 Now the total salary is calculated.
S.no Name Salary
1 Krish 5000
2 Karthi 6000
3 Krishna 4000
4 Vinay 3000
Total salary 18000
Step 6: Auto formatting the table
 Select the table in the document.
 Choose Table Auto format option in the table menu.
 Now, it shows the Table Auto format dialog box.

7 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

 Choose the required format from the formats list box.


 Now the specified format is applied to the table.
Step 7: Convert table to text
 Select the table in the document.
 Chose the convert –table to text options from the table menu.
 Now it shows convert table to text dialog box.
 Choose the separator of the text. Click OK
 Now, the information is converted into text in a document
Step 8: Convert Text to table
 Select the text in the document.
 Choose the convert text to table options from the table menu.
 Now it shows convert text to table dialog box.
 Choose the table size and separator text option. Click OK
 Now, the text information is converted into table.

8 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Ex No: 3 Mail Merge


Aim: To work with mail merge and letter applications
Procedure:
Step1: Mail Merge
 Select File option in the menu bar and click New, to open a new document.
 From the Tools menu select the mail merge
 It shows the mail merge helper dialog box.
 In the Main Document area of mail merge helper dialog box, click on create button.
 Select Form Letters from the pull down menu of create button.
 Click Active Window button in Microsoft Word dialog box.
Step 2: Creating a data source
 In the mail merge helper dialog box, click Get data button
 Select create Data source... to get create Data Source dialog box.
 Select the appropriate fields from the field names in the header row drop down list box or
add new fields by typing the field name in the field name box and click on Add Field Name
 Type the appropriate name for the data source, and then click OK.
 It shows the dialog box asking to add records to the database in the following dialog box.
 Click on Edit Data Source, to add records to the data source.
 It shows the Data Form dialog box; add records to the data source
 Click OK, then the Mail Merge toolbar is automatically displayed in the main document.
Step 3: Creating the merged document
 Click on the Insert Merged Field on the mail merge toolbar.
 Selected the desired results from the drop down menu of the insert merge field.
 After inserting the merge fields, choose Tools->mail merge
 Mail merge helper dialog box shows, from this dialog box, click merge then click on
Merge button, to create a new document. Now the main document and data source is
Merged into a new document.
Step 4: Printing labels
 Choose tools->Envelopes and labels option
 It shows the Envelopes and labels dialog box.
 Type the labels address in the address box provided.
 Then click on full page of the same label option
 Click on new document.
 Now the label is added to the document.
Step 5: Printing envelope letters
 Choose Tools->Envelope and Labels option.
 It shows Envelope and Labels dialog box.
 Type the delivery and return address in the appropriate place in the dialog box.
 Click on the options button to choose the size of envelope cover.
 Click on Add to document option
 Now the envelope is generated
Step 6: Synonyms
9 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

 Select the word in the document, to find their synonyms.


 Choose Tools->Language->Thesaurus.
 It shows the Thesaurus dialog box
 The Thesaurus dialog box itself shows the synonyms for the selected word in the document.
 Choose the appropriate synonyms for the selected word.
Step 7: Letter wizard
 Click on Tools letter wizard.
 It shows letter wizard dialog box
 Choose the appropriate design and letter styles, Click ok
 Now the specified letter design is added to the document. Then fill up the predefined
letter format.
Step 8: Protecting Document
 Click on protect document in the tools menu.
 It shows protect document dialog box.
 Type the password for the document. Click ok
 It shows Confirm password dialog box.
 Now the document is protected. If anyone wants to change the document the word
automatically shows them in red color
Step 9: Showing screen tips
 By default MS-Word automatically shows the screen tips
 Screen tips can also be kept in hide and de-hide mode using tools menu.
 It shows customize dialog box
 Click on options tab
 Click the show screen tips on toolbars, check box for hiding and de-hiding
Step 10: Showing shortcut keys
 By default MS-Word provides the shortcut keys for frequent operations, such as
 CTRL+C for copy, CTRL+V for paste.
 Click on the keyboard button
 It shows the Customize keyboard dialog box
 In the Customize keyboard dialog box choose the appropriate menu and command.
 It shows the default shortcut keys in the current keys
 If we want to assign a new shortcut key for any command, enter the new shortcut key in
the shortcut key area.
Step 11: Counting the words in the document
 Open the document in which counting process is to be carried on.
 Choose the word count option from the tools menu.
 Now it shows number of pages, words, characters, paragraphs and lines in the
current document in the word count dialog box
Step 12: Hiding and Un-hiding the scrollbars in the document
 Click on the options in the tools menu
 Now the options dialog box is shown
 In the view tab, click on the horizontal and vertical scroll bars checkboxes to hide
and de-hide
10 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Ex No: 4 Drawing And Flow Chart


Aim: To draw the needed picture in a word document and also to draw flow charts.

Procedure:
Step 1: Drawing Picture
 Choose the Up Ribbon option in the Stars and Banners of the Auto Shapes menu in the
Drawing Toolbar.
 Draw the required size of Up Ribbon in the document.
 Click on the Insert Word Art icon in the drawing tool.
 Now the Word Art gallery dialog box is shown with different style.
 Choose the required style, and then click Ok.
 Now the Edit Word Art Text box dialog is opened.
 Type the text then click on Ok.
 Place the text then click on OK.
 Place the text in the Up Ribbon.

Step 2: Inserting Picture


 Choose Insert-> Picture -> From File option.
 It shows the Insert Picture dialog box is opened.
 Then click on Insert button. It inserts the selected picture into the document.
 Then it automatically shows the Picture toolbar.
 Using the Picture toolbar, we can control the picture attributes such as giving borders,
o increasing and decreasing brightness and contrast etc
 Using the picture toolbar, we can control the picture attributes , such as giving borders,
o Increasing and decreasing brightness and contrasts etc.
Step 3: Adding Shadows and 3 d effects to the Word art
 Click on the Insert WordArt icon in the drawing toolbar.
 Now the WordArt gallery dialog box is opened with different style.
 Choose the required style, and then click Ok.
 Now the Edit WordArt Text box dialog box is shown.
 Type the Text and then click Ok.
 Now the word Art is shown in the document.
 Click on the Shadow button in the drawing toolbar.
 It shows the different Shadow styles, and their setting, apply them as required.
Click on the 3D button in the drawing toolbar.
 It shows the different #D styles, and their setting, apply them as required.
Step 4: Designing
 Click on the insert clipart button in the drawing Toolbar.
 Now the Insert ClipArt dialog box is opened.
 Navigate and choose the required clipart then add them to the document.
 Choose Callouts option in the Auto shapes menu of the Drawing Toolbar.
 Click on the Insert Word Art icon in the drawing toolbar.
11 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

 Now the WordArt gallery dialog box is shown with different style.
 Choose the required style, and then click ok.
 Now the Edit Word Art Text box is shown.
 Type the text then click Ok.
 Place the WordArt in the appropriate places.
Step 4: Flow Chart
 Choose Flowchart option in the Auto shapes menu of the Drawing Toolbar.
 Choose the appropriate flowchart symbol, and then drag the symbol in the document.
 Type the text in the Symbol, but right click then choose Add Text.
 Using the Arrow button Line Style Using the Arrow button Line Style Arrow Style in the
drawing Toolbar draw the lines connecting to the different flowchart symbols.
 Select all the flowchart symbols and lines in the document using the Select Objects button,
then right choose Grouping, then click on Group.
 Now all the Flowchart symbols are grouped into one.

Ex No: 5 Charts In Spreadsheet


Aim: To try out different types of charts in Excel.

Procedure:
Step1: Graphs in excel
Enter the data in the Worksheet as follows

 Choose Chart option from the Insert menu, or choose the chart wizard button from the
Insert menu, or choose the Chart Wizard button from the Standard toolbar.
 It shows the chart Wizard Step 1 of 4 Chart type dialog box.
 Choose the appropriate Chart type from the Chart type list box then click next.

12 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

 Shows the Chart Wizard Step 2 of 4 Chart source Data dialog box, then click next.
 Shows the Chart Wizard Step 3 of 4 Chart options dialog box, here we can give the Chart
Titles i.e. X and Y-Axis Titles etc then click next.
 Shows the Chart Wizard step 3 of 4 Chart Locations dialog box the click Finish.
 Now the chart is displayed on the active worksheet.

Step 2: Bar Graph

 Type the data as given in the worksheet.


 Click at cell address A1.Click Insert-> Chart.
 Excel will display the first dialog box of Chart Wizard.
 Select Bar graph and click on Next.
 Click on Data Range from the Chart Wizard dialog box.
 Select A1 to E6, and then click next.
 Click in the Chart Title box.
 Click on the category X-Axis.
 Click on the value Y Axis
 Click next, and then click FINISH.
 Excel will display the created chart in the current Worksheet.
 In the same way, repeat the steps for creating 3D and PIE chart.

Step 3: To visible Worksheet data in a chart
 We want to hide and display details in an outline with subtotals or filter data by specific
Criteria by using one of the Filter commands on the Data menu. When you hide, display, and filter
data on a worksheet, the corresponding chart shows only the visible rows and columns.
 Click the chart.
 On the Tools menu, click the Chart tab.
 Select the Plot.
 To show all worksheet data in the chart, even if some rows or columns are hidden, clear
the Plot Visible cells only check box.

Step 4: Inserting ClipArt to the chart


 We can insert an image, E.g.: a bitmap for certain types of data markers, the chart area,
or the legend in 2-D and 3-D charts, or the walls and the floor in 3-D charts.
 To change the chart type of the e4ntire chart, click the chart.
 To change the chart type of a data series, click the data series.
 On the Chart menu, click Chart type.
 On the standard Types or Custom Types tab, click the chart type you want.
 To apply the cone, cylinder or pyramid chart type to a 3-D bar or column data series,
click Cylinder, Cone, or Pyramid in the Chart type box on the Standard Types tab,
and then select the Apply to selection check box.
 Now the chart type is changed from the Bar chart to the Line Chart.

13 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Ex No: 6 Formula, Formula Editor


Aim: To learn about working using formula and formula editor in excel
Procedure:
Step 1:For calculation
 For HRA put the cell in E2 and press =( equal to) for entering the formula.Then chose the C2
cell
( Basic salary ) and type * ( multiplication operator ) and type 18% then press Enter.Now the
18% HRA from BASIC is calculated.
Then drag that formula for entire records.

 For TA put the cell pointer in E2 and press = (equal to) for entering the formula the choose
the
C2 cell (Basic salary) and type * ( multiplication operator ) and type 15% then press Enter.
 Now the 15% TA from BASIC is calculated. Then drag that formula for entire records.
 For GS (Gross salary): put the cell pointer in J2 and choose=, then click on C2 cell + click
on D2 + click on E2 + click on F2 and press enter. Now the gross salary is calculated.
 Drag the entire cell.
 Follow the above steps for DD and NS calculations
 After all calculations, select the data in the worksheet, then choose Data->sort from the sort
dialog box, choose name for the sort order.
Step 2: To change font type and size
 Choose Format-> cell menu selection, a Format cell dialog box appears, from that dialog box
14 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

 Choose Font tab, then change the required type of font, font style and size.
 To insert rows and columns, choose insert->row and insert->column menu selections for row
and column insertion.
 For editing data in worksheet, choose the active cell in which you want to edit data, then
double click on it press F2 function key or click on the formula bar.
 To add headers and footers option from the view menu.
 A page setup dialog box appears, from that choose headers and footers tab. Then type the
header text in header area and footer text in footer area.
Step 3: Conversions
 Click Tools->Add ins dialog box
 In the Add-ins dialog box, click the checkbox of Analysis toolbar, Analysis toolbar-VBA
 Click on A2; enter the decimal number in rows. Click on B2, type=dec2bin (A2), copy the
formula to the remaining, as it converts decimal number to binary.
 Click on C2, type=dec2hex (A2), copy the formula to the remaining, as it converts decimal
number to hexadecimal
 Click on A15, enter the decimal number in rows type=dec2dec (A15), copy the formula to
the remaining, as it converts decimal number to binary.
 Click on C15, type=dec2hex (A15), copy the formula to the remaining, as it converts binary
to hexadecimal
 Click on D15, type=dec2oct (A15), copy the formula to the remaining, as it converts binary
to octal system.
Step4: Employee pay
 Enter the employee details as shown in the table above
 click in cell D2, type =IF(C2<8000,C2*56/100,C2*44/100)
 click in cell F2, type =C2*0.1
 click in cell G2, type =C2+D2+E2
 Click in cell H2 type=G2-F2
 copy the formulae to the remaining records
 Place the cursor in H8,type=MAX(H2:H4)
 The maximum salary will be displayed.) Place the cursor in H9,type=MIN(H2:H4)
 The minimum salary will be displayed.
Step5: To find the sum of the marks
 Enter the student name, marks in three subjects.
 Place the cursor in E2, type=SUM (B2...D3)
 Place the cursor in F2, type=AVERAGE (B2...D3)
 Click on G2, type
 =IF(OR(B2<35,C2<35,D2<35)”FAIL”,IF(F2>=75,”DISTINCTION”,
IF(F2>=60,”FIRSTCLASS”, IF(F2>=50,”SECOND CLASS”,”THIRD CLASS”))))
 Copy the formulae to the remaining students

15 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Ex No: 7 Inclusion of Objects, Pictures And Graphics


Protecting the Document and Sheet

Aim: To insert objects, pictures in the spreadsheet.

Procedure:

Step 1: Inserting Objects in the Worksheet

 There are so many objects that can be inserted into the worksheets.
 Choose Objects option in the Insert menu.
 Choose Picture option from the Insert Menu.
 Choose appropriate object from the Auto shape menu of the Drawing toolbar.

Step 2: Inserting a picture:

 Choose picture option in the Insert Menu.


 Then choose from file option.
 Now the Insert Picture dialog box is opened.
 Navigate and choose the picture to insert into the worksheet
 Then click on Insert button.
 Now the selected picture is inserted into the worksheet.
Step 3: Inserting Comments in the Worksheet
 Comments are helpful for identifying the elements in the graph.
 Select the cell in which comment to be added.
 Choose Comments option in the Insert Menu.
 Now the comment portion of the particular cell is edited.
 Then type the comments for the cell.
 Click on the outside of the comment.
 Whenever you place the cell pointer in that cell, the comment is automatically shown.
Step 4: Organization Chart
 Choose Organization chart option in the picture option of the Insert Menu.
 Now it opens the Microsoft Organization Chart.
 Type the text in the boxes provided and use appropriate options.
Step 5: Inserting a Function
 Click on Paste Function button in the Standard Toolbar or choose Function Option
in the Insert Menu.
 Now the paste Function dialog box is shown with the functions available in the Ms-
Excel.
 Choose the required function, and then click OK.
 Now the required function is edited and added to the worksheet.
Step 6: Open the number of worksheets at a time.
16 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

 Open number of worksheets in the same workbook.


 Then choose Windows->Arrange…,it shows that Arrange Windows dialog box, as
shown below.
 Choose Cascade option from the Arrange Windows dialog box.
 Now all the worksheets are cascaded in the current workbook.
Step 7: Establish link between two or more worksheets.
 Open a New Workbook, from File -> New option.
 Click on any cell and then choose Data->Consolidate option.
 It shows the Consolidation dialog box.
 Click on Browse button to browse other worksheet.
 It shows the Browse dialog box, choose appropriate worksheet then click on OK button,
like add worksheet to consolidate.
 Click on OK button, it shows the data from different worksheet , which are linked to the
Current Worksheet.
Step 8: Show the worksheet in 3D effect
 Open the worksheet, using File-> Open option
 Now it opens the selected worksheet.
 Now choose Format-> AutoFormat…
 Now it shows the AutoFormat dialog box.
 Click on the 3D Effects auto format.
 Now the worksheet is shown in 3D format style.
Step 9: Protect a sheet in MS-Excel
 Click on cell, which you want to protect.
 Choose Tools->Protection, then choose Protect Sheet, it shows the Protect Sheet dialog
box asking the Password to protect the sheet.
 Type the password click Ok. Then it asks for confirmation password box. Type the same
password again and then click Ok.
 Now the sheet is under protection.
 If you click on any cell to type, then the following message box appears by specifying the
sheet under protection.
 To remove protection, Choose Tools->Protection->Unprotect sheet then type the
password to unprotect.
 Now the sheet can be unprotected.
 Follow the same procedure by choosing the
Tool->Protection->Protect Workbook option, to protect the Workbook.
Step 10: Protecting the Workbook
 Open the Workbook to protect.
 Choose Tools->protection, then choose Protect Workbook, it shows the Protect
Workbook dialog box asking the Password to protect sheet.
 Type the password and click and click Ok. Then it asks for the Confirmation password
Box. Type the same password again and then click Ok.
 Now the sheet is under protection.
 To remove protection, choose Tools->Protection->Unprotect sheet,then type the same
Password to unprotect
17 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

 Now the sheet can be unprotected.


 Follow the same procedure by choosing the Tool->Protection-> Protect Workbook
Option, to protect the workbook.
Ex No: 8 Sorting and Import/ Export Features
Aim: To perform sorting and Import/Export Features.

Procedure:
Step 1: Enter the data into Worksheet
 Enter the Name, Department, and Salary in different columns.
 Click Data-> Form option, it shows the form.
 Click New button in the Form to add the rows to the list.
 After adding the rows, place the cursor in the list in the worksheet.
 Click Data-> Sort; it shows the Sort dialog box.
 In the Sort by drop down list select Dept, click Ok.
 Again in Sort, Click Salary fro Then By drop down list.
 The rows re sorted now, depending on the DEPT and SALARY.
 Click Data->Filter->Auto filter, it shows an arrow at each field.
 On the Dept click the icon select Accounts.
 The list of rows which belongs o Accounts is displayed.
 Place the cursor in A15, find the sum using SUM formula.
 In the same way find each department’s total salary.

Step 2: Create transport reservation sheet

 Click on A5, Enter “Passenger Name”,


 Click C5, choose Data->Validation.
 The Data Validation dialog box is opened.
 Click on Setting Tab.
 Select Text Length from Allow dropdown list.
 Select Less than or equal to from Data list box.
 Type 20 in Maximum box.
 Click Input Message tab. In the Input Message box, type
“Please Enter Name”.
 Click the Error Alter tab. Select Stop from Style.
 In the Error Message box type, “Not to exceed 20 characters”.Then click Ok.
 Click on A7, Enter “Gender”.
 Click C7, Click Data -> Validation.
 Click Settings tab. Select List from Allow drop down list.
 Type Male, Female in the Input Message, type “Select Gender Please”, then click
OK
 Click C9, click Data->Validation.
 Click Setting Tab. Select Whole Numbers from Allow drop down list, Between
from Data 1, in minimum and 100 in maximum.
 Click Input Message tab, in the Input Message box type, “Enter Seat Number”.
18 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

 Select Stop from Style, in the Error Message box type. “Number selected is out of
range”.
 Click on A11, “Enter Class”.
 Click Settings tab select List from Allow drop down list, type FIRST, SECOND, THIRD
in Source.
 Click Input Message tab, in the Input Message box type, ”Please Select Class”, then
Click OK
 Click on A12 Enter “Amount’.
 Click C12,type = IF(C11=”FIRST”, 500 ,IF (C11=”SECOND”,400 ,300))
Step 3: Subtotals
The Subtotals are helpful to analyze the data in the list and quickly create reports and
Charts.

 Type the list in a worksheet with column as Salesman, Product, and Sale.
 Select all, and then Sort the sales Column to add subtotals.
 Click Data->Subtotals
 The Subtotal dialog box appears.
 Select the column name from each change in drop down list box to add subtotals.
 Use the Sum function from the Use function drop down list box.
 Select the field names Sales, Product from the Add Subtotals drop down list box.
 Click OK to add subtotals and a grand total.
 Now the list displays the subtotals and grand total.
Step 4: Creating the Customs Fill Series
 If we have already entered the list of items you want to use as a series, select the list on the
worksheet.
 On the Tools menu, click Options.
 Now the Options dialog box is opened.
 Click the Custom Lists tab.
 To use the selected list, click Import.
 To type a new list, select New list in the Custom lists box and then type the entries in
the List entries box , beginning with the first entry. Press ENTER after each
. When the list is complete, click on Add button.

Step 5: Saving workbook for use in another program

 Open the workbook we want to save for use in another program.


 On the File menu, click Save As
 In the File name box, type a new name for the workbook.
 In the Save as type list, click a file format that we can open in the other program.5.6)
Click on Save button.

19 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Ex No: 9A Circumference Of The Circle


Aim: To write a program to find the area and circumference of the circle.

Algorithm:

Step 1: Start the program.


Step 2: Input the radius of the circle.
Step 3: Find the area and circumference of the circle using the formulae
Area=3.14 * r *r
Circumference= 2 * 3.14 * r
Step 4: Print the area and circumference of the circle.
Step 5: Stop the program.

Flow Chart:

Start

Read radius

Area=3.14 * r *r

circumference= 2 * 3.14 * r

Print
area,circumference

Stop

Source Code:
#include<stdio.h>
#include<conio.h>
Void main()
{
float radius, area, circum;

printf("Enter the radius");

20 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

scanf("%f",&radius);
area=3.14*radius*radius;
circum=2*3.14*radius;
printf("\nArea=%f",area);
printf("\nCircumfrerence=%f",circum);
getch();
}

Output:
Enter the radius 4
Area=50.240002
Circumfrerence=25.120001

Ex no: 9 B Conversion of Binary To Decimal


Aim: To write a program to convert the binary number to a decimal number.

Algorithm:

Step 1: Start the program.


Step 2: Enter the binary value.
Step 3: Set a loop
Step 4: Convert the binary number into decimal by using statement given:
Digit binary number % 10
Decimal decimal + (digit< < base)
Base base + 1
Binary number binary number/10
Step 5: After the e4xecutioon of the loop print the decimal value equivalent to the entered
binary number.
Step 6: Stop

21 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Flowchart:
Start

Read bnum

Binbnum

Is
bnum=
0

bnum
Digital bnum % 10

Decimaldecimal+(digital< base)

Bnum bnum/10

Print bin,decimal

Stop

Source Code:
#include<stdio.h.
main()
{
int bnum,digit,decimal=0,bin,base=0;
printf(“\nEnter the binary number”);
scanf(“%d”,&bnum);
printf(“%d”,bnum);
bin=bnum;
while(bnum!=0)
{
digit=bnum%10;
22 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

decimal=decimal+(digit< < base);


base=base+1;
bnum=bnum/10;
}
printf(“\n The binary equivalent of %d in decimal = %d”,bin,decimal);
}

Output:
Enter the binary number 100
The binary equivalent of 100 in decimal =4

Ex No: 9 C Sine and Cosine Series

Aim: To write a program to print sine and cosine series

Algorithm:
Step 1: Start the program.
Step 2: Read x and n
Step 3:Convert x values into radian using formula x=x*3.1412/180
Step 4: t x;
Step 5: sum=x;
Step 6: setup for loop i=1 until (i<n+1) increment 1
Step 7:t (t*(pow(double)(-1),(double(2*i-1))*x*x)/(2*i*(2*i+1)
Step 8: t1 (t1*pow((double)(-1),(double)(2*i-1))*x*x)/(2*i*(2*i-1));
Step 9: sum sum+t;
Step 10: print sum
Step 11: stop

23 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Flow Chart:

start

Read x,n

x=x*3.1412/180

for i=0;i<n;i++

T=(t*(pow(double)(1),(double

(2*i-1))*x*x)/(2*i*(2*i+1)

T1=(t1*pow((double)(1),(double)

(2*i-1))*x*x)/(2*i*(2*i-1));

Print sum

stop

Source Code:
#include<stdio.h>
#include<conio.h>
24 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

#include<math.h>
void main()
{
float x, t,sum,t1,sum1;
int i,n;
clrscr();
printf("Enter the value of x,n : ");
scanf("%f%d",&x,&n);
printf("%4.2f %d\n",x,n);
x=x*3.1412/180;
t=x;
sum=x;
t1=x;
sum1=x;
for(i=1;i<n;i++)
{
t=(t*pow((double)(-1),(double)(2*i-1))*x*x)/(2*i*(2*i+1));
sum=sum+t;
}
for(i=1;i<n;i++)
{
t1=(t1*pow((double)(-1),(double)(2*i-1))*x*x)/(2*i*(2*i-1));
sum1=sum1+t1;
}
printf("The value of SINE(%f)=%6.4f\n",x,sum);
printf("the value of COSINE(%f)=%6.4f\n",x,sum1);
getch();
}

Output

Enter the value of x,n : 45 10


45.00 10
The value of SINE(0.785300)= 0.7070
The value of COSINE(0.785300)= 0.5553*/

Ex No: 9 D Program To Find the Exponent of the Given Number


Aim: To write a program to find the exponent of the given number.

Algorithm:

Step1: Start
Step 2: Enter the X and n Value.
Step 3: Set a loop up to n
Step 4: Find the exponent value of x
25 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

temp= temp* x / i
Sum= sum+ temp
Step 5: After the execution of the loop print the exponent value of x
Step 6: Stop
Flowchart

Start

read x,no

i=1

is Print
i<no Sum

i=i+1

temp=temp * x /i
Stop
Sum = sum + temp

Source Code:
// Exponential Series
#include<stdio.h>
main()
[
float x,temp=1,sum=1;
int i,no;
printf(‘Enter the numbers”);
scanf(“%f%d”,&x,&no);
for(i=1;i<no;i++)
{
temp=temp * x / I;
sum=sum + temp;
}
printf(“Exponent of x is %f\n”,sum);
}

Output:
Enter the numbers
5
26 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Exponent of x is 65.375000

Ex No: 9 E Triangle Of Numbers

Aim: To write a program to print triangle of numbers

Algorithm:

Step 1: Start the program


Step 2: Declare the variables I,j,k,l and n as “int” datatype
Step 3: Read N numbers of lines in a triangle
Step 4: Initialize l=1;
Step 5: for i=1,j=n-I to less than or equal to n
Step 5.1: for k=1, to less than or equal to j print “ ”
Step 5.2: for k=1, to less than or equal to 1 print “i ”
Step 5.3: I is incremented by 2
Step 6: Stop the program

27 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Flow Chart:

start

Read N no of
triangle

for(i=1;j=n-I;i<=n;i++;j--)

for(k=1;k<=l;k++)

Print “ “

for(k=1;k<=l;k++)

Print i

Increment “I” by2

stop

Source Code:

#include<stdio.h>
main()
{
int i,j,k,l,n;
28 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

printf(“type n-no of lines in triangle \n”);


scanf(“%d”,&n);
l=1;
for(i=1;j=n-i;i<=n,i++,j--)
{
for(k=1;k<=j;k++)
printf(“ “);
for(k=1;k<=l;k++)
printf(“ %d”,i);
printf((“\n”);
l+=2;
}
}

OUTPUT
Type N-no of lines in triangle
4
1
2 2 2
3 3 3 3 3
4 4 4 4 4 4 4

Ex No: 9 F Pascal Triangle


Aim: To write a program to print the Pascal triangle

Algorithm:

Step 1: Start the program


Step 2: Read input noline
Step 3: Initialize 1 to i
Step 4: Check i<=noline else goto step -22
Step 5: j 1
Step 6: Check j<= online else goto step -11
Step 7: Initialize temp with i
Step 8: Print
Step 9: Increment temp with i
Step 10: goto Step-6
Step 11: Increment j by 1
Step 12: goto Step-4
Step 13: Initialize i by 1
Step 14: Check j<=I else goto Step-18
Step 15: Print temp++
Step 16: Increment j by 1
Step 17; goto step-14
29 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Step 18: Move 1 to j


Step 19: Is j<I else goto step-22
Step 20: print temp—
Step 21: Increment I by 1
Step 22: Stop

Flow Chart:

start

Read noline

For(i=1;i<=noline;i++) B

For(j=1;j<=noline;j++)

Print “ ”

Temp=I

For(j=1;j<I;j++)

Print
temp++

Temp=temp-2

30 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

For(j=1;j<I;j++)

Print temp--

print

stop

Source Code:
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int line,c,n,x;
void pasc(int);
printf("\n\nEnter the no. of rows: ");
scanf("%d",&line);
printf("\n\n\n");
printf("\nPascal's triangle :\n");
for(x=line-1;x>=0;x--)
printf(" ");
printf("1\n\n");
for(n=2;n<=line;n++)
{
for(c=line-n;c>=1;c--)
printf(" ");
pasc(n);
printf("\n");
}
getch();
}
void pasc(int n)
{
31 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

int r;
long fact(int);
for(r=0;r<=n;r++)
printf("%3ld ",fact(n)/(fact(n-r)*fact(r)));
}
long fact(int v)
{
if(v==1||v==0)
return(1);
else
return(v*fact(v-1));
}

Output

Enter the no. of rows: 3


Pascal's triangle :
1
1 1
1 2 1

Ex no: 10 A Program to add two matrices

Aim: To write a program to add two matrices

Algorithm:

Step 1: start the program


Step 2: Enter the row and column of the matrix
Step 3: Enter the elements of A matrix in the matrix form
Step 4: Enter the elements of B matrix in the matrix form
Step 5: Print the A matrix in the matrix form
Step 6: Print the B matrix in the matrix form
Step 7: Set a loop up to row
Step 8: Set an inner loop up to the column
Step 9: Add the elements of A and B in column wise and store the result in C matrix
Step 10: After the execution of the two loops. Print the value of C matrix
Step 11: Stop

32 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Flow chart

start

Read m,n

For i=0 to m

For j=0 to n

Read a[i][j]
Read b[i][j]

For i=0 to m

Print “\n”

For j=0 to n

C[i][j]=a[i][j]+b[i][j]

Print c[i][j]

stop

33 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Program

#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],b[10][10],c[10][10];
int i,j,m,n;
clrscr();
printf("Enter row and column of two matrices : ");
scanf("%d%d",&m,&n);
printf("Enter the elements of A matrix.\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
}
printf("Enter the elements of B matrix. \n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&b[i][j]);
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
printf("Addition of A and B matrix:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
printf("%5d",c[i][j]);
printf("\n");
}
}

34 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

OUTPUT

Enter row and column of two matrices : 3 3


Enter the elements of A matrix.
123
123
123
Enter the elements of B matrix.
123
123
123
Addition of A and B matrix:
2 4 6
2 4 6
2 4 6

Ex No: 10 B String Length And Concatenation

Aim: To write a program to find the string length and concatenation of string.

Algorithm:
Step 1: Start the program
Step 2: Enter the String
Step 3: Find the string length using the function strlen()
Step 4: Print the string length of the entered string
Step 5: Concatenate the two string using the function strcat()
Step 6: Print the concatenated string
Step 7:Stop.

35 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Flow chart

start

Read string1 and string2

S1=strlen(s1)

S1=strcat(s1,s2)

Print string length and


concatenated string

stop

Source Code:

#include<stdio.h>
#include<conio.h>
void main()
{
char str1[50],str2[]=”WELCOME”;
int len;
printf(“Enter the string”);
scanf(“%s”.str1):
printf(“The String length of %s is %d, str1,strlen(str1));
printf(“The concatenated string length is %d and its string is %s”,strlen(str1),strcat(str1,str2));
}

Output:
Enter the string…. CSE
The string length of CSE is 3
The concatenation string length is 6 and its string is CSE WELCOME

36 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Ex No: 11 A Student Detail

Aim: To write a program to assigning values to the structures variables and retrieving values.

Algorithm:
Step 1: Start the program
Step 2: Struct Std
Rno, Marks : integer
Name[10] :character
End
Step 3: Read S.rno, S.name,S.marks
Step 4: Print S.no,S.name,S.marks
Step 5: Stop

Flowchart:

start

struct std

Rno,marks:integer

Name[10]: character

End std

Read s.rno,s.name,s.marks

print s.rno,s.name,s.marks

stop

Source Code:

#include<stdio.h>
#include<conio.h>
Struct std

37 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

{
int rno,marks;
char name[10];
}s;
void main()
{
clrscr();
printf(“Enter Student Details:\n”);
printf(“Enter the Register No,Name and Mark\n”);
scanf(“%d%s%d”,&s.rno,s.name,&s.marks);
printf(“\n’);
printf(“Rollno\t\t Name\t\tMarks\n’);
printf(“%d\t\t%s\t\t%d”,s.rno,s.name,s.marks);
getch();
}

Output:

Enter the student Details:


Enter the regNo, Name,Marks:
111 Ram 98
RollNo Name Marks
111 Ram 98

Ex No: 11 B STUDENT DATA BASE

Aim: To write a program to maintain student database using Union

Algorithm:

Step 1: Start
Step 2 : UnionStd
Rno, marks :integer
Name[10]: cjaracter
End Union
Step 3: Read total number of students n
Step 4: Read s[i].rno,s[i].name,s[i].marks
Step 5: Print s[i].rno,s[i].name,s[i].marks
Step 6: Stop

Flow Chart:

38 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

start

Union std

Rno,marks:integer

Name[10]: character

End std

Read n

For(i=0;i<n;i++)

Read s[i].rno,s[i].name,s[i].m.marks

print s.rno,s.name,s.marks

stop

Source Code:
#include<stdio.h>
#include<conio.h.
typedef union std
{
int rno;
char name[10];
int marks;

39 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

}student;
void main()
{
int I,n;
clrscr();
printf(“Enter upper limit”);
scanf(“%d”,&n);
printf(“Enter student details”);
printf(“Enter the Roll no, Nmae and Mark:\n”);
for(i=1;i<=n;i++)
scanf(“%d%s%d”,&s[i].rno,s[i].name,&s[i].marks);
printf(“\n”);
printf(“Student details are \n\n”);
printf(“Roll no \t name\t\t Name\t\t Marks\n”);
for(i=1;i<n;i++)
printf(“%d\t\t%s\t\t%d\n”,s[i].rno,s[i].name,s[i].marks);
get6=ch():
}

OUTPUT:
Enter the upper limit: 3
Enter student details:
Enter the Rollno, Name and Mark:
111 Ram 80
222 Ravi 78
333 Mani 80

Student Details are:

Roll no Name Marks


111 Ram 80
222 Ravi 78
333 Mani 80

Ex No:12 A Recursion Using Function


Aim: To write a program to find the factorial of the given number using recursion.

Algorithm:

Step 1: Start
Step 2: read num
Step 3: arecur(num)
Step 4: print num,a;
Step 5: Stop
Step 1: recur start
Step 2: fact 1
40 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

Step 3: Is no=1
T : return
F : fact  no * recur(no-1)
Step 4: return
Flow chart

start

Read num

A=recur(num)

Print a

stop

Recur(no)
41 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

No
Is(no=1) Fact=no*recur(no-1)

yes

return

Source Code:
#include<stdio.h>
#include<conio.h>
void main()
{
int num,a;
printf(“Enter the number”);
scanf(“%d”,&num);
a=recur(num);
printf(“The factorial of the number %d is %d”,num,a);
}
recur(int no)
{
int fact=1;
if(no==1)
return(1);
else
fact=no * recur(no-1);
}

Output
Enter the number 5
The factorial of the number 5 is 120

Ex No:12 B FUNCTIONS WITH ARGUMENTS AND WITH RETURN

42 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

VALUES
Aim: To write a program to illustrate a function with arguments with return bvalues.

Algorithm:
Step 1: Start the program
Step 2: Enter the two numbers
Step 3: Call the function with two arguments passed to it
Step 4: Add the two numbers in the calling function
Step 5:Return the addition value to the called function from the calling function.
Step 6: Print the addition value in the main function
Step 7; Stop

FLOW CHART:

Start

read a,b

call add(a,b) add (a,b)

c=a+b

print c

return c

Stop

Source Code:

43 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I

#include<stdio.h>
main()
{
int a,b,c;
pinntf(“Enter the numbers.”);
scanf(“%d%d”,&a,&b);
c=add(a,b);
printf(“The addition of two numbers %d and %d is %d”,a,b,c);
}
add(int x, int y)
{
int z;
z=x+y;
return(z);
}

Output:

Enter the numbers….5 7


The addition of two numbers 5 and 7 is 12

44 R. M. D. ENGINEERING COLLEGE

You might also like