You are on page 1of 71






Prepared by

Ms. Preethi Sheba Hepsiba Darius, Lecturer, CSE

Ms.K.Vidya, Lecturer, IT

Mr.T.C.Ezhil Selvan, Lecturer, IT


List of Experiments

1. Document creating, Text Manipulation with Scientific Notations.
2. Table creation, Table formatting and Conversion.
3. Mail Merge and Letter Preparation.
4. Drawing – Flow Chart.


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.


9. Data types, Expression Evaluation, Condition Statements.
10. Arrays
11. Structures and Unions
12. Functions.


TABLE FORMATTING AND 6 CONVERSION Lab 2 – Sample output 8 3 MAIL MERGE AND LETTER PREPARATION 9 Lab 3 – Sample output 11 4 DRAWING – FLOWCHART 15 Lab 4 – Sample output 17 SPREADSHEET * 5 LINE.Sample output 5 2 TABLE CREATION. PROTECTING THE DOCUMENT AND SHEET 8 SORTING AND IMPORT / EXPORT FEATURES 33 Lab 8 – Sample output 35 iv . TEXT MANIPULATION 1 1 WITH SCIENTIFIC NOTATIONS Lab 1 . BAR and PIE 19 Lab 5 – Sample output 21 6 FORMULA EDITOR 25 Lab 6 – Sample output 28 7 INCLUSION OF OBJECT.No Name of Experiment Page No. List of Experiments iii Table of Contents iv WORD PROCESSING * DOCUMENT CREATION.CONTENTS S. PICTURE AND 31 GRAPHICS. XY.


TEXT MANIPULATION WITH SCIENTIFIC NOTATIONS AIM To create a document in OpenOffice. b. SHIFT+PAGE UP 1 . Save document with extension . manipulate text and do scientific notations. Type definition of Work Processing. Click Open to view the Writer. 2. Place the cursor in front of “Word”. ALGORITHM PART A: Document Creation 1. On the File menu. SHIFT+PAGE DOWN G. click New->Text Document. Create a web page. Create a resume document. Write down the corresponding action to the following keyboard selections: A. a. Start OpenOffice. 3.doc. 4. SHIFT+LEFT ARROW C.doc. c. Choose Resume template from the Templates and Documents dialog box. SHIFT+UP ARROW Writer in Linux. click New->Text Document.html. : 1 WORD PROCESSING DOCUMENT CREATION.htm or . 2. PART B: Text Manipulation 1. SHIFT+RIGHT ARROW B. click New->HTML Document. on the File menu.EX. Modify resume and save as . NO. SHIFT+DOWN ARROW E. CTRL+SHIFT+RIGHT ARROW D. On the File menu. Create a new blank document and save with extension .

Go to Insert->Header->Default. Type today's date on the right. 3. Go to Format->Character-> Font Effects and check Shadow option. Bottom: 1. Set Margins.25 inch. Right: 1 inch. a. b. Press 'OK'. Set Font size to 16pt. Go to Insert ->Footer->Default and type “Contact me @ <insert your email address>”. c. 7. CTRL+SHIFT+END J. 4. b. a. type “Watches for Sale”. Type your name on the left. a. Insert the graphic by clicking Insert->Graphics->From File. Type “SRIT-CSE/CIVIL” in the center and c. Case Color. Left: 1. 5. b. Top: 1. To format Text. Set up the page by using Format->Page. Set Paper Size to A4. CTRL+A PART C: Formatting the document 1.25 inch. c. 2 . CTRL+SHIFT+HOME I. 2. Open a new document by choosing File->New->Text Document. Brand Name: CITIZEN Case Color : Black Case Material : Stainless steel. Insert an image of a watch. Type the features of the watch such as Brand Name. Select text. Set Page Layout as Left and Right. 6.25 inch. H. Click the Bold icon and give a center alignment by pressing the centered icon in the object bar. Case Material etc.

00”.5 Line Spacing from the option box. Select List Price “$215. Choose the Font Effects tab. 15. Go to Format->Paragraph. To insert symbol. a. type “In Stock”. Go to Format->Character.doc. 10. Write down the corresponding Format to the following keystrokes. PART D: Scientific Notations 1. select “Citizen”. Save documents as . Choose Font Color as Red. Choose 1. Highlight the entire bulleted list. a. type the following List Price : $215. Go to Format->Bullets and Numbering. 9. 11. b. Press 'OK”. Choose Font Size as 14pt. 14.5 line spacing. Choose solid circled bullets.00 Price: $129. choose 1. 8. Price “$129. c. Open a new document by choosing File->New->Text Document. Keystroke Format CTRL-1 CTRL-5 CTRL-2 CTRL-0 13. go to to Format->Case/Characters->Uppercase. go to Insert->Special Character and insert the '©' symbol. Go to Format->Character. To create a hyperlink for the brand name.00”. 3 . b. To change line spacing. Type your name. 17.00 Save Up to : $86 (40%). go to Format->Character and choose the Hyperlink tab. go to Format->Paragraph. Enter Product features in a bulleted list. Enter the website address in URL field. In the Strikethrough option give single. To change case. 16. To change orientation. Type “SEIKO”. To format character. Choose 90 degrees. Press 'OK'. 12. Close the document. go to Format->Position->Rotation.

Save the document as formulas. Write down the corresponding formula in the editor. set operations.sxw and Close. Alternatively. A2+B2. Select the 2 in A2+B2. 4. b b2 4 ac Type the following formula 2a a.2. 3. functions. {+-b sqrt{b sup 2 . then choose Format->Character->Position as subscript. then choose Format->Character->Position as superscript. c. 4 . Type the formulas as H2O. relations. attributes and brackets. Select the 2 in H2O.4ac}} over {2a } b. Insert a formula object by using the option Insert->object->formula bar. Write down all the unary binary operators. operators. 5.


b. To merge cells. Alternatively. b. 21. Insert another row and delete it. Choose 8 columns and 6 rows. select cells to be merged and either press the Merge cells icon or right-click->Cell->Merge Cells or Format->Cell->Merge Cells. To insert row go to Format->Row->Insert. Give title as “TIME TABLE CSE SEMESTER 1 2009/10 ”. To insert column. Type your class timings in the first row and days (Mon-Fri) in the first column. ALGORITHM PART A: Table Creation and Formatting 18. Enter “Saturday”. 26. 25. Create a table. NO. Specify amount and position. Choose Tables toolbar. Insert a row after Friday. Select the amount and position. Go to Insert -> Table. : 2 WORD PROCESSING TABLE CREATION. place cursor on row to be deleted and press the Delete Row icon or right-click->Row->Delete or Format->Row->Delete. 24. a. 20. Merge all the periods for Labs. Merge all periods for Saturday and Type – Holiday 6 .EX. 22. do formatting and conversion in OpenOffice. 23. a. Go to View->Toolbars->Customize. TABLE FORMATTING AND CONVERSION AIM To create a table. To delete a Writer. click the Inert table icon in the main toolbar. Open a new document by choosing File->New->Text Document. go to Format->Column->Insert or press the Insert Row icon in the Table toolbar or right click->Column->Insert. Insert columns for lunch break and tea break. 19.

Create a calendar for this month. To convert text to table. a. 29. 7 . To select row height and width. 28. column 2. Key Type: numeric. Press Ok. Give line style 2. Select the Holiday cell and split into 2. Go to Format->Table. c. Subject and Marks Obtained.5 inch. Direction: rows. Key Type: Alphanumeric. Check Key 1. 2. 4. c.50pt. Select the subjects and marks. b. 2. PART D: Conversion 1. Create a new table with 2 columns. eg. Type months of a year separated by tabs or semicolons or paragraphs. To set row height go to Format-> Row-> Height. Choose the mode of separation. a. To set column width go to Format ->Column->Width. b. PART B: Sorting and Performing Calculation 1. 2. Order: Ascending. 27. 3. a. Calculate the percentage by giving the formula in the editor. enter the formula in editor. PART E: Autoformat Table Creation 1. Convert the table back into text. Give 0. select cells to be split and either press the Split cells icon or right-click ->Cell->Split Cells or Format->Cell->Split Cells. column 1. semicolons. To calculate sum of all marks click Formula icon. Go to Insert->Table->AutoFormat. Merge all the cells in column for lunch and tea break. Order: descending. Select the table created. select the table. Give title as MY MARKS. and write output. Go to Tools -> Text <-> table. Check Key 1. Go to Tools->Sort. b. Direction: rows. Go to the Borders tab. To split cells. Create table from Autoformat.

45 12. 1.11. 2.40. Table to text January February March January . March. 9. 3.40 3.40 2.30 Monday Tuesday Wednesday Thursday Friday Saturday HOLIDAY Part B: Sorting and Performing Calculation MY MARKS Subject Marks Chemistry 95 Maths 50 Physics 85 Total 230 Percentage 46.30 4.SAMPLE OUTPUT Part A: Table Creation and formatting TIME TABLE CSE SEMESTER 1 2009/10 8.00% Part C: Conversion of Text to table.40 10. 10.35 11.45.45 .50. February . Part D: Autoformat Table Creation Mon Tue Wed Thu Fri Sat Sun 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 8 .40.30 - 9.45 .

4. 9 . create fields from the data source. 5. To register addressBook as Data Source. 3. In sheet 1. Go to View->Data Sources or click the Data source icon in main toolbar. choose Type as Mail Merge Fields. 7. choose Name: address. Repeat to insert other fields. Part B: Creation of Mail Merge 3. choose Data Source: Address. : 3 WORD PROCESSING MAIL MERGE AND LETTER PREPARATION AIM To quickly produce personalized letters and mailing labels using Mail merge feature in OpenOffice. Last Name.sxc in a folder named “Mail Merge Lab”. ALGORITHM Part A: Creation of the Address Book 1. go to File->New->Spreadsheet. Table: Sheet 1. Create a spreadsheet. Choose Database type: Spreadsheet. Zip code from columns A1 to F1. Click on the Administrate… button and create a New Data Source. go to File->New->Text Document. 2. Click ok. choose “First Name” and click Insert. 6. Type First Name. go to Insert->Fields->Other.sxc is stored in Data Source URL. Choose the Path where addressBook. State. In the templates: Address Book Assignment Dialog box. To insert fields for mail merge. Save the spreadsheet as addressBook. 2. 4.”. address. NO. In the general tab. 8. Add addresses of 3 people.E. Do Field assignment for the address. Open writer.EX. In the Database tab. go to File->Templates->AddressBook Source. In the To. Prepare a letter for “Offer for admission to B. Street. City.

Go to Format tab to change the position and size. choose database as Address and Sheet 1. d. Create Folder EnvelopesMM. Open new document. Set Path to this folder. Click on Insert to Insert the Envelope. Choose option “From this Document”. 10 . Choose Generate File Name from Database field “First Name”. 9. Choose Database as Address and Table as Sheet 1. Create Folder labelsMM. Set addressee data from database. Open new document. c. 3. In addressee data. Part D: Mailing Label 1. To do Mail Merge. 7. Create a folder called “letterMM”. go to Tools->Mail Merge. 6. Part C: Autopilot Letter Creation. Write letter for “Leave Letter” and do mail merge. Save as “Envelope. To create letter. Set the Path to the folder called Mail Merge. 4. 4. 2. a. Save as “mailingLabel. Create Folder lettersMM. Part E: Creation of Envelope 1. Write output. Go to File->New->Labels. Perform Mail merge and save in folder called “EnvelopeMM”.sxw” Go to Insert->Envelope.sxw”. and set Path to labelsMM. Create a folder called “labelsMM” Follow steps for mail Merge. go to Autopilot->Letter. 5. Navigate to Sheet 1 and choose all 3 records. In Mail Merge Dialog Box. 2. Enter your address as sender. 3. Click on New Document. Choose Output: File option. b. 2. 3. Follow the wizard. Go to the Printer tab to change the orientation of the envelope. 1.

The classes will commence on 7th September 2009. Offer of Admission to B.SAMPLE OUTPUT Part B: Creation of Mail Merge SRI RAMAKRISHNA INSTITUTE OF TECHNOLOGY Pachapalayam. <Zip Code> Part C: Autopilot Letter Creation.(CSE) With reference to your application.E in the branch of Computer Science and Engineering in the academic year of 2009/2010. 11 . Chettipalayam. <City>. Coimbatore – 641 010 Date: 15th October 2009 Dear Candidate. <Street>.E. Perur. we are pleased to inform you that we are admitting you in B. <State>. Please bring along all the original certificates. <First Name> <Last Name>. PRINCIPAL To.

12 .

Part D: Mailing Label 13 .

Part E: Creation of Envelope 14 .

d. 3.EX. Triangle. go to Format->Wrap->Edit. Parallel c. e. b. Bring to Front b. go to Tools->Options. Circle. c. Using the drawing toolbar draw a. Click and drag the Drawing toolbar to create a floating toolbar. Draw square. NO. To view a grid. To wrap text around object. To arrange objects. Square. : 4 WORD PROCESSING DRAWING – FLOWCHART AIM To use drawing tools in OpenOffice. Open a new document. Send to Back 6. f. No Wrap b. choose elipse tool and hold shift button. go to File->New->TextDocument. Optimal 5. Diamond. 4. Rectangle. Parallelogram. Bring Forward c. Check “Visible Grid”. ALGORITHM Part A: Basic Drawing Functions. Click on the Draw Functions icon in the main toolbar. 2. choose Rectangle tool and hold shift button. Go to Format-> to draw flow charts. Send Backward d. Choose a. Through d. Expand Text. 1. go to Format->Arrange. using polygon tool. Choose a. 15 . Go to Format->Position and Size->Slant and set Angle. set 45 degrees.

b. Draw rectangles for processes or events. 3. To enter text. 8. go to Flip- >Horizontally. select all objects by holding Shift button and clicking on the object. Go to Format->Group->Group. To draw a flow Chart for a. Use arrows to denote the flow of the program. Part B: Flow Chart 1. Flip->Vertically. 7. To check whether a given number is even or odd. To group. Draw ellipses/circles for Start and Stop. Draw diamonds for decision boxes having Yes or No decisions. 7. 16 . Draw parallelograms for input and output. 5. 2. Withdraw cash from ATM. To flip Vertically go to. choose the Text tool and double click on object to enter text. 4. 6. To flip Horizontally.

pincode Validate account No Is Valid? Yes Enter Withdrawal amount Balance > No Withdrawal Yes Print Insufficient Balance Dispense cash Print receipt End 17 .Withdraw cash from ATM Start Enter Account Number.SAMPLE OUTPUT Part B: Flow Chart .

Part B: Flow Chart .To check whether a given number is even or odd. Start Enter a number Divide number by 2 Yes No Is remainder 0? Print number is Print number is Even Odd End 18 .

give a rotation of 60 degrees. : 5 SPREADSHEET LINE. NO. a. To change the orientation of the labels. go to the Scale tab. Check ‘First row as label’ and ‘First column as Label’. g. 3. Y-axis: Temperature/degrees. go to Applications->Office->Spreadsheet/OpenOffice. Double-click X axis. To format the chart area. To insert a chart. Bar charts. XY. doubles click on the data series line on the graph. go to the ‘Data labels’ tab. Check the show value checkbox. a. Go to the ‘line’ tab. Choose data series in ‘Columns’. Calc. To open spreadsheet. 2. 4. c. Check grid lines for both rows and columns. d. BAR and PIE AIM To create Line charts. 5. Press Next e. Pie charts and XY Plots using Spreadsheet in Calc. e. 6. To format the data lines. double click on the chart. To format labels along the axis. ALGORITHM Part A: Line Chart 1. Double-click Y axis. Enter the data for drawing a line chart for weather forecast for this week. b. set appropriate color. c. b. Click ‘Create’.EX. a. To change the scale. Go to the ‘Area’ tab and give color as ‘White’. Give axes titles for X-axis: Days of the week. Choose ‘Line Chart’. 19 . width as 0. go to ‘label’ tab. f.02. To show data value on graph. go to Insert->Chart. Give Chart Title as ‘Weather Forecast in Coimbatore for this week’. Set Major Interval as ‘2’. press next. b.

Rename the sheet. 8. go to File->Save As. Part B: Bar Chart 1. write procedure for the creation of bar chart. right-click on sheet 1->Rename. To insert a new sheet. 20 . give name as ‘Line Chart’. (Hint: Go to Scale Tab in Data Point).sxc (OpenOffice. Set the Y axis from 2000. 9. Give chart Title: ‘Country Wise export of tea from India from 2005-2006’.org Format) and . 7. create data label of the importing country and quantity of export as percentage. 2. Part D: XY Plot Create an XY plot. Name it ‘The Impact of Moore’s Law’. Construct a side-by-side double bar chart for the following frequency table. In a new sheet named ‘Bar Chart’. Create a 3D pie chart. construct a Vertical and Horizontal bar chart for the following data. Part C: Pie Chart Create a pie chart using the following data.xls (Microsoft Excel). Set the name of the IC’s and Microprocessors in the first column as a data label. go to Insert->Sheet. For each share in the pie chart. . To save spreadsheet.

SAMPLE OUTPUT Part A: Line Chart Temperature (degrees) Day Morning Afternoon Evening Sat 30 33 24 Sun 26 29 25 Mon 25 30 25 Tue 25 32 25 Wed 26 31 25 Thu 25 30 24 Friday 24 30 23 Weather forecast for Coimbatore this week 35 33 32 31 Temperature / degrees 30 30 29 30 30 30 25 26 25 25 25 26 25 25 24 24 24 23 20 Morning 15 Afternoon Evening 10 5 0 Sat Sun Mon Tue Wed Thu Friday Days of the Week 21 .

of Month visitors January 150 February 300 March 250 OUTPUT Frequency of Visiters to the Museum Frequency of Visiters to the Museum 350 300 250 300 250 ch ar No. of Child 300 200 visitors 200 100 0 May June July Month 22 .Part B: Bar Chart No. of adult No. of Visiters 250 M Month 200 300 150 y 150 ar bru 100 Fe 150 50 ry nua 0 Ja January February March 0 100 200 300 400 No. of Visitors 500 500 No. of adult Visitors 400 300 No. of Visiters Month Side by Side Bar Chart No. of Child Month Visitors visitors May 300 200 June 500 600 July 700 600 Frequency of Visitors to the Museum 800 700 700 600 600 600 No.

99 Germany 3.07 Australia 2.84 Pakistan 3.59 Country Wise export of tea from India from 2005-2006 Other Russia countries 21% UK Russia UAE Saudi Arabia 17% 3% USA Kazakhstan Australia UK Pakistan 3% Iran 16% 3% Germany Germany Pakistan UAE 4% Iran Australia 15% 5% Kazakhstan USA Saudi Arabia 6% 7% Other countries 23 .Part C:Pie Chart Importing Quantity of Country export (%) Russia 17.48 UK 15.16 USA 7.8 UAE 15.88 Saudi Arabia 2.31 Kazakhstan 6.72 Other countries 20.18 Iran 4.

of Transistors 7002000 6002000 5002000 Transistors 4002000 Intel Pentium 3002000 2002000 Intel 486 1002000 Intel 386 4004 80088080 8086 Intel 286 2000 70 75 80 85 90 95 00 19 19 19 19 19 19 20 Year of Introduction 24 .Part D: XY Plot Year of Introduction Transistors 4004 1971 2300 8008 1972 2500 8080 1974 4500 8086 1978 29000 Intel 286 1982 134000 Intel 386 1985 275000 Intel 486 1989 1200000 Intel Pentium 1993 3100000 Intel Pentium II 1997 7500000 Intel Pentium III 1999 9500000 Impact of Moore's Law Intel Pentium III 9002000 8002000 Intel Pentium II No.

starting from cell address A1.EX. use the : (colon) operator. Observe the formula in Sheet 2. Alternatively. Now try to edit formula. Choose cells corresponding to Test 1. place cursor in cell F2 (Total). mathematical. = SUM(D2:D6)/5 to calculate average. 2. go to Sheet 2. select cells in Total (F2 to F6) 1. type =. Press OK. To copy the formula. To audit and correct errors. 7. = Calc Spreadsheet. a) Click on the error. 1. use the &(ampersand) operator. Select cells D2 to D6 or type formula. To perform calculations on another worksheet. 4. Check 'Hide Formula'. 9. go to Insert->Function. type =. Draw the arrows resulting in 25 . 6. 5. type &” “&. 2. Try to multiply cell B2*D2:D6. To select a range. 2. Write down the message obtained after protection. click A2. To protect sheet. 3. Copy and paste formula in E7. place cursor in cell D7. Copy and paste in cells F3 to F6. go to OpenOffice. 3. Press OK. Go to Format->Cells->Protection->Cell Calc Spreadsheet. Note: Spreadsheet uses relative reference. Auditing and Error Codes 1. Type. To open. To concatenate strings. type. click B2. To enter basic arithmetic operators. To insert a function. go to Tools->Detective->Trace Error. copy then paste in cells C3 to C6. choose SUM. Place cursor in cell C2. 3. 8. Choose category. Type Total in A1. then click Sheet 1. NO. =A2&” “&B2. In A2. ALGORITHM Part A: Entering Formula. Go to Tools->Protect Document->Sheet. Enter the following data. : 6 SPREADSHEET FORMULA EDITOR AIM To create and edit formulas and use built in formulas using Formula Editor in OpenOffice.

To count the occurences of transactions with billing date on 2nd oct. =COUNTIF (C3:C6. To determine logical conditions. ####. Eg. Type. b) Type = POWER(8 . go to Insert->Sheet. #NAME?. Tax is 20% of Salary. B1:5. Enter the following data for a set of bank transactions. IF salary >10000. to perform Trigonometrical functions. Also write down possible examples where this error occurs. 6. Enter the following data. Part B: Commonly Used Formulas 3. TAN using the functions. enter in A1:7. =D3- (E3+F3)+G3 6. cos and tan. A2). else Tax is 10%. #VALUE!. type. d) Add A3 to C3 to get value in decimal. To calculate Tax. COS. calculate SIN. Choose the sheet and protect it. Perform conversion between various number systems Logical Functions 7. a) Convert 756 in octal to decimal. in A2. OR. 1). 3. =POWER(8 .. PRODUCT. #DIV/0!. Part C: Built In Functions Mathematical Functions 1.149 to 1 decimal place. = Salary – (Tax + Withdrawal) + Deposit. NOT functions 26 .20/100*D3. To use SUM. Enter 5 numbers. 7. =IF(D3>10000. 10. b) Go to Tools->Detective->Remove Precedents to remove the arrows. 2). 4. insert a seperate chart for sin. the mistake. To calculate Running Balance. B2. use AND. Trigonometrical Functions 5. . #NUM!. write formula. Insert new sheet."02/10-09"). Copy and paste formula to B3 and C3. 5. 4. Write down the reasons for the following error codes (Look up in Help) #N/A. find MAXIMUM value. #REF!. 0). Find the QUOTIENT of 5/2.10/100*D3). =POWER(8 . #NULL. POWER. ROUND number 2. C1:6.. C2. type =PRODUCT(A1 . go to cell D8. 2. eg. c) In A3.

Change the full name from upper to lower case using LOWER function. Change the full name to upper case using UPPER function. To work with text. Concatenate First Name and last name using CONCATENATE function b. enter the following data a. 27 . c.TEXT FUNCTIONS 2.

SAMPLE OUTPUT Part A: Entering Formula.4503E-16 28 .707107 -1 360 -2E-16 1 -2.20/100*D3. Name Date Salary Tax Withdrawal Deposit Running Balance 101 Jane 2/10/2009 10000 1000 500 1000 9500 102 Michael 2/10/2009 5000 500 0 5000 9500 103 Priya 4/10/2009 15000 3000 10000 0 2000 104 Prasanna 5/10/2009 30000 6000 5000 2000 21000 Syntax of formulas used: Tax =IF (D3>10000. Auditing and Error Codes Test First Name Last Name Full Name 1 Test 2 Total Divya Kumar Divya Kumar 25 20 45 Johnny Lane Johnny Lane 30 25 55 Vidya Karan Vidya Karan 35 31 66 Varun Sharma Varun Sharma 15 35 50 Rose Reynolds Rose Reynolds 25 36 61 Sum 130 147 Average 26 29.13E-17 1.70711 -1 180 1E-16 -1 -1.707107 1 90 1 6.4 Syntax of formulas used: Full Name =A2&” “&B2 Total = E2+F2 Test 1 Total = SUM(D2:D6) Test 1 Average = AVERAGE(D2:D6) Part B: Commonly Used Formulas BANK TRANSACTIONS Billing Acc No.70711 1 270 -1 -1.7071 -0.Mathematical Functions Degrees sin cos Tan 0 0 1 0 45 0.8E-16 5.10/100*D3) Balance =D3-(E3+F3)+G3 Part C: Built In Functions .707 -0.707 0.6325E+16 135 0.7071 0.2251E-16 225 -0.4415E+15 315 -0.

5 CONVERSION FUNCTIONS Conversion Number Answer Decimal to Binary 29 11101 Decimal to Octal 952 1670 Decimal to Hexadecimal 872 368 Binary to decimal 1100000 96 Syntax of formulas used: =DEC2BIN(B2) =DEC2OCT(B3) =DEC2HEX(B4) =BIN2DEC(B5) LOGICAL FUNCTIONS a b D = a AND b E= a OR b F= NOT a D AND F 0 0 FALSE FALSE TRUE FALSE 0 1 FALSE TRUE TRUE FALSE 1 0 FALSE TRUE FALSE FALSE 1 1 TRUE TRUE FALSE FALSE Syntax of formulas used: D =AND(A2.B2) E =OR(A2.B2) F =NOT(A2) D AND F =AND(C2.5 1 0.E2) 29 .Syntax of formulas used: sin =SIN(RADIANS(B2)) cos =COS(RADIANS(B2)) tan = TAN(RADIANS(B2)) sin 1.5 -1 -1.5 0 sin 0 30 60 90 120 150 180 210 240 270 300 330 360 -0.

TEXT FUNCTIONS First Name Last Name Full Name To Upper To lower Jenna Dewan Jenna Dewan JENNA DEWAN jenna dewan Michael Michael Phelps Phelps MICHAEL PHELPS michael phelps Ray Romano Ray Romano RAY ROMANO ray romano Syntax of formulas used: =CONCATENATE(A2.” “.B2) =UPPER(C2) =LOWER(D2) 30 .

click object. To insert a picture on a worksheet. click the object. go to Insert->Object->OLE object. To resize the object. Include an OLE object. b. To resize an object by a specific percentage. horizontally or diagonally from center. go to drawing Toolbar. 4. go to Format-Position and Size. select object. Change the size of the image. Go to the Rotation tab. To resize proportionally from center outward. 1. 1. ALGORITHM Part A: Working with Picture and Graphics. hold CTRL+SHIFT and drag corner sizing handle. Go to Position and Size tab. Choose Base Point as center. hold down SHIFT button. To constrain rotation of object to 15 degree angles. To rotate a drawing object. Part B: Working with Auto shapes/objects. a. b. 5. check ‘Keep Ratio’ to keep the original ratio. choose. NO. 6. a. : 7 SPREADSHEET INCLUSION OF OBJECT. 31 . Pictures and graphics and to protect the document and sheet in OpenOffice. go to Format->Position and Size. drag sizing handle. Insert->Graphics->From File or go to Tools->Gallery to select an image. go to Applications->Office->OpenOffice. 2. To resize proportionally. click the Free Rotate icon. Calc Spreadsheet. PROTECTING THE DOCUMENT AND SHEET AIM To include objects. hold SHIFT and drag corner of sizing handle.EX. PICTURE AND GRAPHICS. hold CTRL and drag sizing handle. b. Drag the rotation handles to rotate the object. To resize vertically. Calc. ( red circular handles ). Set a rotation angle of 45 degrees. To open spreadsheet. To rotate an object by specifying angles. a.

“Hello World” a. go to Tools->Protect->Sheet/Document. b. 5. go to Convert->3D. 2. click whenever to add a curve. Convert the smiley to Bitmap. Right-click->Edit Points to edit the points. To unprotect the sheet/document. 8. Set the text in the desired format. go to File->Save As. To convert to 3D right-click the smiley. a. Set Shading option and shadow. 7. point to curves in the drawing toolbar. To draw a curve. Check the “Save with Password” option. Check Position/Size. Double click to end the curve. 6. 4. 2. Choose ‘Create New’ and object type as Drawing. 32 . d. go to the Text tool. Type. 3. Under Protect. Go to Tools->Protect->Sheet/Document. b. To protect all documents when saving. To move stacked objects. To close the shape click near starting point. 3. go to Format- >Position and Size->Position and Size tab. click object. hold down the SHIFT to maintain shapes’s width-to-height ration. Part C: Protecting the Document 1. To include font work. To protect the cell ranges in a sheet. a smiley using the available shapes. c. right-click->Convert->Metafile. Convert the smiley to Metafile. Draw an autoshape. Give Password and confirm the given password. graphics and OLE objects and drawing objects. b. go to Format->Font Work. To insert text. Enter the password in the dialog box and save. right-click->Convert->Bitmap. Hide All. choose all the cells that span the drawing a. click the text. a. If object is hidden behind other objects press TAB or SHIFT+TAB. To add Shadow. To draw circle. right-click->3D Effects. To protect frames. a. Go to Format->Cell Protection. choose an ellipse tool.

33 . To sort. go to Data->Sort and go to the Options tab. Sort the data in a descending manner. Click OK. write down output. Ascending c. Go the Options tab. NO.EX. Check “Custom sort order” and choose “Monday. Click on the Sort By drop down box and choose column name to sort. ascending/descending 2. To sort columns based on the contents of rows. To sort data in a list. weekdays or custom lists. 7. Then choose Then By Name. go to Data->Sort. 4. Write the output. c. Click ok. enter the following data. Select cells. 5. b. Ascending 6. by clicking the Descending sort from the standard toolbar. 3. enter the following data a. b. a. Choose Sort By Branch. To sort months. a. Alternatively go to Data->Sort. : 8 SPREADSHEET SORTING AND IMPORT / EXPORT FEATURES AIM To perform sorting and import/export functions in OpenOffice. ALGORITHM Part A: Sorting data in a list 1. by clicking the Ascending Sort from the standard Calc Spreadsheet. Choose Direction as “Left to Right(sort columns)” c. a. Tuesday. Select the cells. Select all the names. To sort rows based on the contents of two or more columns. b. Write the output. go to Data->Sort. Sort the data in an ascending manner. Click on option Ascending/Descending to specify sort order. b.…” from the drop down menu.

To open a spreadsheet in read-only mode. go to Autopilot ->Document Converter. go to File->Export as PDF. Set path of folder for importing in Import. 5.Part B: Import/Export 1. 3. 4. Go to File>Open->File Type. go to File->Autopilot->Database Import. 2. choose the .xls from Save As menu. a. To export. check the ‘read-only’ box when opening a file. To import a database into Spreadsheet. To export multiple OpenOffice files to Microsoft Office. b. 34 . 6. To export a single OpenOffice file to Microsoft Office file. Set path for folder to contained converted documents in Save As. List any 10 file formats that is supported by the Calc Spreadsheet Application.

SAMPLE OUTPUT Part A: Sorting data in a list Ascending Sort 1 Ruby 8 Angela 2 Liz 7 Blaine 3 Maria 4 Emma 4 Emma 10 Jerry 5 Michael 2 Liz 6 Phoenix 3 Maria 7 Blaine 9 Max 8 Angela 5 Michael 9 Max 6 Phoenix 10 Jerry 1 Ruby Sorting 2 columns Branch Name Branch Name CSE Ruby CIVIL Angel CIVIL Angel CIVIL Maria MECH Blaine CSE Jerry MECH Ricky CSE Liz CSE Phoenix CSE Michael CSE Jerry CSE Phoenix CSE Liz CSE Ruby CIVIL Maria MECH Blaine MECH Max MECH Max CSE Michael MECH Ricky OUTPUT Sorting left to right 5 8 4 3 2 2 3 4 5 8 Custom Sort Day Menu Day Menu Tuesday Rice Monday Chappati Thursday Parota Tuesday Rice Monday Chappati Wednesday Thosai Friday Briyani Thursday Parota Wednesday Thosai Friday Briyani 35 .

Step 6: Stop the program. circum END 36 .14. EXPRESSION EVALUATION AND CONDITION STATEMENTS AREA AND CIRCUMFERENCE OF CIRCLE AIM To write a program to find the area and circumference of circle.14*radius. Step 5: Display area and circumference. Step 3: Calculate area of circle by using formula.EX. ALGORITHM Step 1: Start the program. NO. circum = 2*3. area. Step 4: Calculate circumference of circle by using formula. circum.14*radius* radius. : 9 C PROGRAMMING DATA TYPES. Step 2: Get user input for radius of circle. r READ radius r CALCULATE area := PI*r*r CALCULATE circum :=2*PI*r PRINT area. PSEUDOCODE BEGIN INITIALIZE PI as 3. area = 3.

14 * radius * radius Circum = 2 *3. program to calculate area and circumference of circle is executed and output is verified 37 . printf("Enter radius: "). circum = 2 * Pi * radius. circum.area. } OUTPUT: Enter radius: 5 Area=78.14159 main() { float radius.circum).14 * radius Print area Print circum Stop PROGRAM #include<stdio.2f \n".2f". scanf("%f".42 RESULT Thus. printf("\nCircumference=%0.h> #define Pi 3. printf("\nArea=%0. area= Pi * radius * radius.&radius).FLOWCHART Start Read radius Area = 3.54 Circumference=31.area).

Step 4: Display the factorial of the given number. Step 3: Set loop to find factorial of given number using formula fact = fact*i. ALGORITHM Step 1: Start the program. FACTORIAL OF A GIVEN NUMBER AIM To write a program to find the factorial of a given number. fact as 1 READ num REPEAT fact := fact*i INCREMENT i UNTIL i <= num PRINT fact END 38 . PSEUDOCODE BEGIN INITIALIZE i as 1. Step 5: Stop. Step 2: Get user input for the factorial number.

FLOWCHART Start Initialize i=1. scanf("%d". printf("Enter a number: "). while(i <= num) { fact *= i. } printf("Factorial: %d\n". i++. fact=1. fact). fact=1 Read number fact= fact * i i++ Yes Is i <= num No Print factorial Stop PROGRAM #include <stdio. &num). program to find factorial of given number is executed and output is verified. } OUTPUT Enter a number: 5 Factorial: 120 RESULT Thus. int num.h> int main() { int i=1. 39 .

Step 6: Print the Fibonacci number in every iteration of the loop. Step 5: Calulate fib= fib + a. ALGORITHM Step 1: Start the program. GENERATING FIBONACCI SERIES AIM To write a program to generate Fibonacci series up to a given number. exit. b=1. a. Step 4: Set loop up to given number. If zero print zero. Step 7: Stop the program. Step 2: Enter the limit Step 3: Check whether the number is zero or not. PSEUDOCODE BEGIN DECLARE lim. set a=b and b=c for every iteration in the loop. lim=1 fib = a + b READ num IF num == 0 PRINT 0 REPEAT a=b b= fib fib = a + b INCREMENT lim PRINT fib UNTIL lim < num END 40 . b INITIALIZE a=0.

int a=0. int lim =0. fib =a+b. b=fib. &num). int num.h> int main() { int fib=1. b=1. fib = a+b. i=0. b=1 fib = a+b Read number Yes Is num == 0 Print 0 No a=b. Yes Print fib Is lim < num No Stop PROGRAM #include <stdio. lim++. printf("Enter the limit: "). 41 . scanf("%d".FLOWCHART Start a=0.

program to generate Fibonacci series is generated and output is verified. } OUTPUT Enter the limit: 5 ** Generating Fibonacci series.")... printf(" %d". b=fib. lim++.. num). if(num == 0) printf("%d". while(lim < num) { a=b. 42 . } printf("\n"). fib). fib = a+b. printf("** Generating Fibonacci series. 2 3 5 8 13 RESULT Thus..

print the given value is odd. print the given value is even. Step 7: End. Step 4: Check if rem is 0. Step 2: Enter integer value. PSEUDOCODE BEGIN DECLARE rem READ val DETERMINE rem = val%2 IF rem == 0 PRINT Value is Even ELSE PRINT Value is ODD END 43 . ALGORITHM Step 1: Start the Program. Step 6: If rem is not 0. Step 3: Determine rem = value modulo 2. CHECK WHETHER A GIVEN NUMBER IS EVEN OR ODD AIM To write a program to find out whether a given number is even or odd. Step 5: If rem is 0.



Enter value

rem = val % 2

Is rem == 0

Print even Print odd


int num,rem;
printf("Enter a number: ");
printf(" \n The entered number is EVEN \n");
printf(" \n The entered number is ODD \n");

Enter a number: 5
The entered number is ODD
Enter a number: 2
The entered number is EVEN

Thus program to find whether a given number is even or odd is executed and output is



To write a C program to find the area of triangle

Step 1: Start
Step 2: Read the input values of a,b,c;
Step 3: Compute s=(a+b+c)/2;
Step 4: Compute d=(s*(s-a)*(s-b)*(s-c))
Step 5: Find the area of triangle with the formula area=sqrt(d)
Step 6: Print area
Step 7: Stop

DEFINE AS int a,b,c
DEFINE AS float s,d,area
Input a, b, c
CALCULATE s= (a+b+c)/2
CALCULATE area=(s*(s-a)*(s-b)*(s-c))
PRINT area


float a,b,c;
double s,d,area;
printf("Enter 3 sides");
scanf("%f %f %f",&a,&b,&c);
d =(s*(s-a)*(s-b)*(s-c));
printf("Area of triangle= %f sq units\n",area);




Read a,b,c

Read s,d,area

s = (a+b+c)/2


Print area



Enter 3 sides 5 10 8
Area of triangle= 19.810035 sq units

Thus a C program to find the area of triangle was executed and output was verified.

x2. x2). x2=(-b .c. x1=(-b + sqroot) / (2*a).b.&a. c CALCULATE sqroot = sqrt(b*b – 4*a*c) CALCULATE x1 = ((-b + sqroot) / 2*a) CALCULATE x2 = ((-b .b. x2 END PROGRAM #include<stdio.c : ").sqroot) / (2*a). sqroot = sqrt(b*b-4*a*c).x2 Step 7: Stop PSEUDOCODE BEGIN DEFINE AS int a.sqroot.&b.b.b.x2 READ a. scanf("%d%d%d". printf("Enter the values of a. printf(“First root is %d”. ALGORITHM Step 1: Start Step 2: Read a.c Step 3: Calculate sqroot=sqrt(b*b-4*a*c) Step 4: Calculate x1=((-b+sqroot)/2*a) Step 5: Calculate x2=((-b-sqroot)/2*a) Step 6: Display x1.x1. x1.FINDING DISCRIMINANT OF QUADRATIC EQUATION AIM To write a C program to find the discriminant of a quadratic equation. } OUTPUT RESULT Thus a C program to find the square root of a given number was executed and the output was verified.sqroot) / 2*a) PRINT x1.&c). 47 .h> #include<math.h> main() { int a. x1 printf("Second root is %d". b.c DEFINE AS int sqroot.

incometax.perks. scanf("%d". PAYBILL CALCULATION USING SWITCH CASE STATEMENT AIM To write a C program for Pay bill calculation using Switch Case statement ALGORITHM Step 1: Start Step 2: Read the data Step 3: Decide the level number and calculate perks Step 4: Calculate gross salary. float scanf("%f%f".jobnumber. jobnumber float gross.basic pay Compute: houserent = 0. switch(level) { case 1: perks=CA1+EA1.&basic). income tax Step 5: Compute the net salary Step 6: Display the result Step 7: Stop PSEUDOCODE Define : int level.incometax Output : Display result PROGRAM #define CA1 1000 #define CA2 750 #define CA3 750 #define CA4 750 #define EA1 500 #define EA2 200 #define EA3 100 #define EA4 0 main() { int level. input: printf("\n enter level.job number. case 2: perks=CA2+EA2.basic.25*basic Gross = basic + houserent + perks net salary = gross . if(level==0)goto stop.&jobnumber.basic pay\n"). printf("enter 0 for level to end\n\n"). 48 .job number.&level).houserent.perks Input : level.

49 . net=gross-incometax. stop:printf("\n\n end the program"). case 3: perks=CA3+EA3. } houserent=0.jobnumber. } RESULT Thus a C program for Pay bill calculation using Switch Case statement was executed and output was verified. else if(gross<=4000) incometax=0.break. gross=basic+houserent+perks. break. printf("\n\n%d%d%f\n". else if(gross<=5000) incometax=0. else incometax=0.08*gross.05*gross. goto input. goto stop.03*gross.level. case 4: perks=CA4+EA4.*basic. if(gross<=2000) incometax=0. default: printf("error in level code\n").

year.interest rate and period\n\n"). Read the values year.value Input : amount. PSEUDOCODE Define : int year. Check the condition whether year<=period 5. year=1.value.value).period 4. printf("input amount. Calculate the value by using the formula a.period Float amount. Start 2. value=amount +inrate +amount 6.&period). C PROGRAM TO CALCULATE SIMPLE INTEREST AIM To write a C program to calculate simple interest using while condition ALGORITHM 1. float amount.inrate 3. printf("\n"). while(year<=period) { value=amount+inrate+amount.&amount. Stop. printf("%d%f\n".&inrate. 50 .rate and period. Assign the amount to value and increment the year by 1 7.inrate. } } RESULT Thus a C program to calculate simple interest using while condition was executed and the output was verified. Condition : while(year<=period) Calculate : value=amount+inrate+amount Output : display result PROGRAM main() { int year. amount=value.inrate. Read the values of amount.period. scanf("%f%f%d". year=year+1.

: 10 C PROGRAMMING ARRAYS SUM AND AVERAGE OF NUMBERS IN ARRAY AIM To write a program to initialize an array of 5 numbers and print sum and average ALGORITHM Step 1: Start the program Step 2: Declare and initialize array of size 5. PSEUDOCODE BEGIN DEFINE N AS 5 INITIALIZE integer array to size 5. Step 3: Set loop up to size of array Step 4: Find sum of array Step 5: After execution of loop. and sum = 0 REPEAT Sum = sum+arr[i] UNTIL i < size CALCULATE avg = sum/N PRINT sum.EX. i=0. NO. find average. avg END 51 . Step 6: Print sum and average of array Step 7: Stop the program.

h> #define N 5 int main() { int arr[] = {10. arr[j] = temp.25}.. int i. for(i=0.5. arr[0]). printf("\n\tAfter Sorting: "). i++) printf("%d ". i++) printf("%d ". arr[i] = arr[j]. i<N.. printf("\n\t** Min Number: %d\n".. After Sorting: 1 2 5 10 25 ** Max Number: 1 ** Min Number: 25 RESULT Thus. arr[N-1]). j. } OUTPUT Before Sorting: 10 2 5 1 25 ** Sorting the array in Descending order. i<N. printf("\n\n\t** Max Number: %d". arr[i]). program to initialize an array of 5 numbers and print sum and average is executed and output is verified. printf("\n"). i++){ for(j=i+1.1. return 0. 52 . j<N.PROGRAM #include<stdio. for(i=0. i<N.. } // end if }// end inner for loop }// end outer for printf("\n\n** Sorting the array in Descending order.\n"). printf("\n\t Before Sorting: ").2. j++){ if(arr[i]>arr[j]) { temp = arr[i].arr[i]). temp. for(i=0.

DYNAMIC INITIALIZATION OF ARRAY DURING RUNTIME AIM To write a program to initialize array dynamically during runtime to calculate sum and average for a given number of values specified by user. Step 7:Print sum and average of array Step 8: Stop the program. avg END 53 . PSEUDOCODE BEGIN INITIALIZE integer array to size 100. ALGORITHM Step 1: Start the program Step 2: Enter the number of array Step 3: Enter the elements of array Step 4: Set loop up to size of array Step 5: Find sum of array Step 6: After execution of loop. and sum = 0 PRINT number of values to enter READ number into num REPEAT PRINT enter value i+1 READ value into arr[i] DETERMINE sum = sum+ arr[i] UNTIL i < num CALCULATE avg = sum/num PRINT sum. i=0. num. find average of array. val.

&val). int i. int sum=0. scanf("%d". } avg=sum/4. arr[i] = val. printf("How many values do you wanna enter?" ). printf("\n\t Average = %. for(i=0. arr[i]). } OUTPUT How many values do you wanna enter?5 Enter Value: 45 Enter Value: 98 Enter Value: 85 Enter Value: 79 Enter Value: 65 Value 1: 45: Value 2: 98: Value 3: 85: Value 4: 79: Sum = 307 Average = 76. sum). val. } for(i=0. program to initialize array dynamically and print sum and average is executed and output is verified.2f \n". i<4. float avg. 54 . i+1. scanf("%d". sum +=arr[i].h> int main() { int arr[100]. i<num. i++){ printf("\n Value %d: %d: ". num. printf("\n\t Sum = %d". avg).00 RESULT Thus.&num). i++) { printf("\n Enter Value: ").PROGRAM #include <stdio. return 0.

then go to loop Step 9: After execution of inner loop. Step 8: If not greater. PSEUDOCODE BEGIN INITIALIZE integer array to size N REPEAT REPEAT IF arr[i] > arr[j] THEN SET temp = arr[i] STORE arr[i] = arr[j] SET arr[j] = temp INCREMENT j UNTIL j < N INCREMENT i UNITIL i<N-1 PRINT array in ascending order PRINT array in descending order 55 . ALGORITHM Step 1: Start the program Step 2: Initialize size of array as N Step 3: Initialize elements of array to N numbers Step 4: Set loop to array size minus 1 Step 5: Set inner loop to array size Step 6: Check whether next array element si greater than current element Step 7: If greater exchange position. SORT ARRAY ASCENDING AND DESCENDING AIM To write a program to sort a given array of variables in ascending and descending order. Step 10: Print ascending order of given array. inner loop is executed. Step 11: Print descending order of given array Step 12: Stop the program.

.. program to sort a given array of variable size in ascending and descending order is executed and output is verified.. i<N. j++){ if(arr[i]>arr[j]) { temp = arr[i]. i<N. printf("\n\n** Sorting the array in Descending order. j. printf("\n\t** Min Number: %d\n".. arr[i]). } // end if }// end inner for loop }// end outer for printf("\n\n** Sorting the array in Ascending order. int i. i>=0.2.h> #define N 5 int main() { int arr[] = {10. arr[0]). i<N.5. 25 10 5 2 1 ** Max Number: 1 ** Min Number: 25 RESULT Thus. arr[j] = temp. 1 2 5 10 25 ** Sorting the array in Descending order.. i++) printf("%d ". i++){ for(j=i+1.. for(i=0.25}. } OUTPUT Before Sorting: 10 2 5 1 25 ** Sorting the array in Ascending order..1. arr[i] = arr[j]. i++) printf("%d ". for(i=0. 56 . arr[i]).arr[i]). temp. return 0. printf("\n\t Before Sorting: "). printf("\n").. printf("\n\n\t** Max Number: %d".\n"). arr[N-1]). j<N. i--) printf("%d ". for(i=N-1.PRINT max Num AS arr[N-1] PRINT minNum AS arr[0] END PROGRAM #include<stdio.\n"). for(i=0.

COLUMNS Step 3: Declare a 2D array. PSEUDOCODE BEGIN DEFINE ROWS AS 5. COLUMNS AS 5 INITIALIZE array Product to ROWS and COLUMNS SET i=0. Product Step 4: Set loop to size of COLUMNS Step 5: Set inner loop to size of ROWS Step 6: Calculate and print product Step 7: Stop the program. MULTIPLICATION TABLE USING 2D ARRAY AIM To write a program to display multiplication table using 2 dimensional array ALGORITHM Step 1: Start the program Step 2: Define ROWS. j=1 REPEAT PRINT COLUMNS label UNTIL i<= COLUMNS REPEAT PRINT ROWS label SET row = i+1 REPEAT SET column=j CALCULATE product[i][j] = rows*columns PRINT product[i][j] UNTIL j<= COLUMNS UNTIL i<= ROWS END 57 .

for(j=1. product[i][j] = row * column. printf("\n"). 58 . // result of multiplication int i.h> #define ROWS 5 #define COLUMNS 5 int main() { int row. int product[ROWS][COLUMNS]. i<+ROWS. product[i][j]). program to display multiplication table using 2D array is executed and output is verified. j<= COLUMNS. printf("________________________________\n"). column. printf("\n\n** Multiplication Table **\n\n"). row). } // end outer for . j++) { column = j. for(j=1. printf(" %4d".j. printf("%2d |".COLUMNS printf("\n").ROWS return 0. j <= COLUMNS. printf(" "). j). i++) { row = i+1. j++) printf(" %4d". } // end inner for . for(i=0. } OUTPUT ** Multiplication Table ** 1 2 3 4 5 ________________________________ 1| 1 2 3 4 5 2 | 2 4 6 8 10 3 | 3 6 9 12 15 4 | 4 8 12 16 20 5 | 5 10 15 20 25 RESULT Thus.PROGRAM #include <stdio.

avg>50 AND res[i]. average and grade for all the students.avg>=80 AND res[i]. register number and marks for 3 tests and store in the structure variable. Step 7: Stop the program. Step 5: Calculate average and grade and store in the union variable. Step 6: print the student name. register number. test 2. : 11 C PROGRAMMING STRUCTURES AND UNIONS AIM To write a program using structures and unions store student details and find average and grade for a set of students. test 3 marks of student STORE in structure variable CALCULATE res[i].test1 +stud[i]. Step 3: Set a loop up to the number of students. NO.avg<=100 59 .avg<70 SET grade AS C ELSE IF res[i].avg<60 SET grade AS D ELSE IF res[i]. marks for 3 tests. PSEUDOCODE BEGIN INITIALIZE structure student as stud[50] and union result as res[50] READ number of students AS no REPEAT READ name and reg no.avg>=70 AND res[i].avg = (stud[i]. test 1.EX. Step 4: Enter name.avg>=60 AND res[i].test3)/3 DETERMINE grade IF res[i].test2+stud[i]. ALGORITHM Step 1: Start the program Step 2: Initialize the structure and union variable.avg<80 SET grade AS B ELSE IF res[i].

h> main(){ struct student{ char name[25]. scanf(" %d %d %d". &stud[i]. int i. test3. i+1). int test1. scanf("%s". scanf("%d". union result{ char grade. 60 .grade = 'D'. test2. &no). SET grade AS A ELSE SET grade AS F INCREMENT i by 1 UNTIL i<no PRINT details of students. printf("Enter number of students:"). i<no. for(i=0. }stud[50]. /* Enter 3 marks and find average */ printf("Enter 3 test marks: ").test3).test2+stud[i].avg<60) res[i]. float avg.avg = (float) (stud[i]. char regno[25]. test3. &stud[i]. &stud[i]. else if(res[i]. }res[50]. &stud[i].name).avg>=60 && res[i].test2.test3)/3.regno). res[i].test1. printf("Enter name: "). no.avg<70) res[i]. int test1. END PROGRAM #include <stdio.grade = 'C'.test1+stud[i]. test2. printf("Enter regno: "). &stud[i]. if(res[i].Enter details of student %d--\n".avg>=50 && res[i]. i++) { printf("-. scanf("%s".

res[i].Enter details of student 2-- Enter name: Dan Enter regno: CS02 Enter 3 test marks: 45 86 54 -. else if(res[i]. else res[i]. } // end for printf("\n** Printing from structure and union **\n"). i<no. stud[i].grade = 'F'.grade = 'A'.Enter details of student 3-- Enter name: Maria Enter regno: CS03 Enter 3 test marks: 77 85 56 ** Printing from structure and union ** Name Reg i++) { printf("\n%s \t %s\t\t %d \t %d \t %d".avg>=70 && res[i]. } printf("\n").Enter details of student 1-- Enter name: Max Enter regno: CS01 Enter 3 test marks: 45 68 95 -. printf("\n Name Reg No. res[i].test2. for(i=0.test3).test1. /* printing from union */ printf("\t %. Test 1 Test 2 Test 3 Average Grade\n"). program to store student details using structures and unions is executed and output is verified.avg>=80 && res[i]. stud[i]. } // end main function OUTPUT Enter number of students:3 -.67 C Maria CS03 77 85 56 72.avg <=100) res[i]. stud[i]. stud[i].67 B RESULT Thus.avg.2f \t %c".grade = 'B'.regno.avg<80) res[i].grade). stud[i]. 61 . Test 1 Test 2 Test 3 Average Grade Max CS01 45 68 95 69. else if(res[i].33 C Dan CS02 45 86 54 61.

NO. IF choice is 2 CALL cube function DETERMINE cube of x = pow(x. Step 5: Perform operation in each function and display result Step 6: Stop the program. : 12 C PROGRAMMING FUNCTIONS AIM To write a program to use function for a simple calculator. ALGORITHM Step 1: Start the program Step 2: Read the value of x. 3) PRINT value of cube IF choice is 3 CALL root function DETERMINE root of x = sqrt(x) PRINT value of root IF choice is 4 EXIT UNTIL choice is 4 END 62 . PSEDOCODE BEGIN READ value of x REPEAT DISPLAY menu GET choice IF choice is 1 CALL square function DETERMINE square of x = x*x PRINT value of square. Step 3: Display menu Step 4: Use switch case statements to call functions corresponding to the menu item.EX.

3) If choice =2 Print cube root = sqrt(x) If choice =3 Print root If choice =4 Stop 63 .FLOWCHART Start Read x Display Menu Read choice square = x*x If choice =1 Print square cube = pow(x.

break. &x). default: printf("Invalid Choice"). input: printf("\n-. case 3: root(x). switch(choice) { case 1: square(x). break. scanf("%d". case 2: cube(x). printf("\n[3] Square root").h> /* function Declarations */ void square(int). printf("\n ** MENU **"). &choice). void root(int). printf("\n[1] Square"). void cube(int). case 4: exit(1). printf("\n[2] Cube").Enter choice: ").PROGRAM #include <stdio. goto input. scanf("%d". int x. printf("\n[4] Exit")./* function call */ break. } // end main 64 . }// end switch goto input. break. main(){ int choice. printf("Enter value of x:").h> #include <math.

Enter choice: 3 Square root of x: 2.2f". } // end function square. program to use C functions for simple calculator is executed and output is verified. x*x). printf("Square root of x: %. } // end function cube void root(int x){ float sqVal.Enter choice: 2 x cube = 125 -. void cube(int x){ int cubeVal. cubeVal). sqVal).Enter choice: 4 RESULT Thus.void square(int x){ printf("x square = %d".Enter choice: 1 x square = 25 -. 65 . printf("x cube = %d".24 -. if(x<0) printf("enter positive value!"). OUTPUT Enter value of x: 5 ** MENU ** [1] Square [2] Cube [3] Square root [4] Exit -. cubeVal = pow(x. else { sqVal = sqrt(x). 3). } // end else }// end function root.

2009 ƒ Balagurusamy. Accessed on: 13-9- 2009 ƒ “OpenOffice. 1e. http://www.html. http://documentation. Tata McGraw Hill 66 . “Computer Programming”.org Tutorials”.org/. “Computing Fundamentals and C Programming. ] ƒ “Tutorials for OpenOffice”.openoffice. accessed on: 13-9-2009 ƒ Kamthane. E. n. ITL Education Solutions Limited.