Вы находитесь на странице: 1из 50

TABLE OF CONTENT

EX. NO
I 1
1.1 1.2 2 3 4

NAME OF THE EXPERIMENT


MICROSOFTWORD Document creation, text manipulation with scientific notations
Document Creation Text manipulation with scientific notations Creation of table Mail merge and letter preparation. Drawing flow chart

II
5 6 7 8

MICROSOFT EXCEL
Chart Line, XY, bar and pie Formula Formula editor Spread sheet Inclusion of objects, picture And graphics, Protecting the document and sheet Sorting and import / export features

III 9
9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 9.10 9.11

C PROGRAMMING Data Types, Expression Evaluation, Condition Statements.


Area and circumference of the circle Converting the Celsius into Fahrenheit Swapping without third variable If-else greatest of three numbers For loop factorial of a number For loop Pascal Triangle While loop Generating Armstrong numbers While loop Binary To Decimal Do While loop Reverse a number Do while loop Fibonacci series Switch Case- Simple Calculator

10
10.1 10.2 10.3 10.4

Arrays
Ascending and descending order using arrays Sorting the alphabets Addition of two matrices Matrix multiplication

11
11.1 11.2

Structures and Unions


Mark sheet processing using structures Payroll processing using union

12
12.1 12.2 12.3

Functions
Functions call by value Functions call by reference Functions recursive function

MICROSOFT WORD

I. DOCUMENT CREATION, TEXT MANIPULATION WITH SCIENTIFIC NOTATIONS Ex. No: 1.1 Date: AIM: To create a document using MS Word that contains a covering letter followed by resume. ALGORITHM: Covering Letter: Step 1: Open a new MS Word blank document. Step 2: Save the file as Letter.doc. Step 3: Type the covering letter with left alignment. Step 4: Provide subject line Step 5: Type the body of the letter Step 6: Close the letter with right alignment. Step 7: Save the file. Resume: Step 1: Type the name, address, phone number and e-mail id with right alignment. Step 2: Type the resume with font size 12 and Times New Roman format. Step 3: Provide the educational qualification Step 4: Provide necessary details and save the file. Step 5: Exit MS- Word. Envelope: Step 1: On the menu, choose Tools -> Envelopes and Labels (Word 97-2003) or On the menu, choose Mailings -> Envelopes and Labels (Word 2007) Step 2: Type the address and click on Add to Document button. Step 3: Save the file and exit MS Word. DOCUMENT CREATION

Place: Chennai Date: July 5, 2011

From Name, Street, City, Pincode . To The Managing Director, Company Name Company Address Respected Sir/Madam, Subject: Applying for the post of programmer I have completed my B.Tech Information Technology in Easwari Engineering ollege,Chennai under Anna University. I saw your advertisement in The Hindu dated 04.09.2011. I would like to join as programmer in your company. Herewith, I am enclosing my resume with this letter. Thanking You, Yours faithfully, Name.

Name ,

B.Tech.,

Address:, Chennai. Phone: +91-zzzzzzzzz Email: xxx@gmail.com OBJECTIVE: To perform tasks with profound knowledge, skills and good attitude. EDUCATIONAL QUALIFICATIONS: Course B.E. Institution of study Easwari Engineering College Board/University Anna University, Chennai Year 2009-2013 Percentage 90.00

Higher Secondary X Standard

AAAA

State Board

2008-2009

85.2

AAAA

Matriculation

2006-2007

84.5

COMPUTER PROFICIENCY: Languages : C, C++, Java Packages : MS-Office Platforms Used : Win XP PROJECTS: ABC ( 2011 2012). PAPER PRESENTED: CCCCC-College Name

ACADEMIC ACHIEVEMENTS: Secured 100% attendance

PERSONAL INFORMATION:
Fathers name :

Mothers name Fathers occupation Mothers occupation Date of birth Age Gender Nationality Marital status Languages known Hobby

: : : : : : M/F : Indian : Single : Speak English Read/Write English :

I, XXX, hereby declare that the particulars stated above are true to the best of my knowledge. SIGNATURE: ________________________ DATE: ________________________

ENVELOPE:

TO THE MANAGING DIRECTOR, M/S WIPRO TECHNOLOGIES, BANGALORE.

RESULT: Thus a document using MS Word that contains a covering letter followed by resume is prepared and verified.

Ex. No.: 1.2

TEXT MANIPULATIONS WITH SCIENTIFIC NOTATIONS

Date: AIM: To create text manipulation with scientific symbols in MS Word. ALGORITHM: Step -1: To open a document, click File menu in the menu bar and select New. A New page will appear. Step -2: Type a paragraph of text in the new opened document. Step -3: To justify the typed text, select the text and click the Justify icon present in the formatting toolbar. Step -4: To make some text as bold, select the text and click the Bold icon present in the formatting toolbar. Step -5: To underline and to give italic style to the text, select the text and click Underline icon and Italic icon one by one present in the formatting toolbar. Step -6: To align the text to left, select the text and click Align left icon present in the formatting toolbar. Step -7: To align the text to center, select the text and click Center icon present in the formatting toolbar. Step -8: To align the text to right, select the text and click Align right icon present in the formatting toolbar. Step -9: To give line spacing as 1.5 for the whole text, select the whole text and click Format menu present in the menu bar and click Paragraph, then give line spacing as 1.5 lines. Step -10: To give the specified font, select the text and click Format menu, click Font then change the font as Monotype Corsiva and give font style as Regular then click OK. Step -11: To give next type of font, select the text and click Format menu, click Font there change the font as Arial and give font style as Bold then click OK. Step -12: To give next type of font, select the text and click Format menu, click Font there change the font as Times New Roman and give font style as Regular then click OK. Step -13: To give next type of font, select the text and click Format menu, click Font there change the font as Trebuchet MS and give font style as Regular then click OK.

Step -14: To add bullets or numbering to the text, select the text and click Format menu, click Bullets and numbering then select the needed type of bullet or number, click OK. Step -15: To give subscript and superscript to the equation, select the particular text and click Format menu, select Font and in effects select Subscript, Superscript and give OK. Step -16: To save the document click File and click Save. OUTPUT STEP 35: A flowchart can be defined as the pictorial representation of a process, which describes the sequence and flow of the control and information in a process. The flow of information is represented in a flowchart in a step-by-step form. STEP 68: Computer Generations Computer Generations Computer Generations STEP 9: A flowchart can be defined as the pictorial representation of a process, which describes the sequence and flow of the control and information in a process. The flow of information is represented in a flowchart in a step-by-step form. STEP 1013: Fundamentals of computing and programming Fundamentals of computing and programming Fundamentals of computing and programming Fundamentals of computing and programming STEP 14: The various symbols used in a flowchart are Start and End Action or Process Decision or condition 1. Arrow 2. Connector

STEP 1516:

Ca(HCO3 )2 CaCO 3 + CO2 + H2O (A + B) 2 = A2 + B2 + 2AB.


-b b 2 4ac 2a

d n ( x ) nx n 1 dx E=mc2 Where, E Energy m mass c velocity

RESULT: Thus a text with scientific notations is created, manipulated using MS-Word.

Ex. No.: 2 Date:

CREATION OF TABLE

10

AIM: To create a table, format it and to convert the table into text and text into table. ALGORITHM: Step -1: To create a new table with five columns and five rows. Select Table Insert. Step -2: Enter the columns as employee name, total salary, Basic pay, DA, HRA and then enter the names of five persons and their Basic pay and HRA. Step -3: To calculate the total salary select TableFormula and in the formula Box give the formula as =SUM(LEFT)which gives the total salary. Step -4: To sort the names of the employees in ascending order , select TABLE SORT and sort by names and give the type as text and click the ok button. Step - 5: To find minimum and maximum select TableFormula and Paste the function as =MIN (ABOVE) and =MAX (ABOVE) Step -6: To change the table into text and text into table type the text and Select the command Table converts Table to text. OUTPUT: STEP 1, 2&3: EMP.NAME HARI SASI RAJA ARUN BASIC 5500 6000 8000 7000 DA 500 450 300 100 HRA 200 150 100 500 SALARY 6200 6600 8400 7600

STEP 4:

11

EMP.NAME HARI SASI RAJA ARUN

BASIC 5500 7000 6000 8000

DA HRA 500 200 100 500 450 150 300 100 MIN SALARY MAX SALARY

SALARY 6200 7600 6600 8400 6200 8400

STEP 6: EMP.NAME BASIC HARI SASI RAJA ARUN 5500 7000 6000 8000 DA 500 100 450 300 HRA 200 500 150 100 SALARY 6200 7600 6600 8400

MIN SALARY MAX SALARY

6200 8400

RESULT: Thus, the table was created, formatted and converted using MS-Word.

12

Ex. No.: 3 Date:

MAIL MERGE AND LETTER PREPARATION.

AIM: To create a mail merged document and prepare letter using MS - Word. ALGORITHM: Step 1: Open a New MS Word blank document. Step 2: Save the document. Step 3: Type a letter with To field empty. Step 4: In the Tools menu click Mail Merge. Step 5: Under Mail Merge Helper window click Create button. Step 6: Select Form letters under Create button. Open the active window. Step 7: In the Mail Merge Helper dialog box click Get data button. Step 8: Create a New data source with the following fields. Title First Name Last Name JobTitle Company Address1 City Postal Code

Step 9: In the data source field enter the address as given below. First Name Mr/Ms XXXX Mr/Ms AAAA A Title Last Name YYYY BBBBB JobTitle Web Designer Java Progammer Company Microsoft Infosys Address1 ZZZZZZZ CCCCCC City Chennai Chennai Postal Code 641 109 641 041

Step 10: Return to the main document. Click Insert Merge field to insert necessary Fields. Step 11: Click the Mail Merge tool under tools menu to merge the document. Step 12: Save the file and exit MS Word.

13

OUTPUT Step 3 From The Manager, State Bank of India, Chennai.

Step 10: Return to the main document. Click Insert Merge field to insert necessary Fields. To TitleFirstNameLastName, JobTitle, Company, Address1, City, PostalCode, Respected Sir/Madam, Subject: Salary account details. The details of your salary account are enclosed with this letter. Thanking you, Place: Chennai Date: August 15, 2009 Yours faithfully, XYZ.

RESULT:

14

Thus, the Mail Merge is prepared using MS-Word.

15

Ex. No.: 4 Date: AIM:

DRAWING FLOW CHART

To create a flowchart the greatest of three numbers. ALGORITHM: Step -1: To insert the symbols of flowchart select auto shapes in the drawing Toolbar. Step -2: The required symbols are selected and inserted into the document. Step -3: The size of the symbols are adjusted and placed in the right position by clicking and dragging out. Step -4: A right click is made on the symbol and select add text option. Then required text is entered in the various symbols. Step -5: Various symbols are connected using connectors.

16

OUTPUT

START

READ A, B, C

YES IF A>B

NO

IF A>C

NO

NO

IF B> C

YES

DISPLAY C IS GREATER

YES

DISPLAY A IS GREATER

DISPLAY B IS GREATER

STOP

RESULT: Thus a flowchart was created to find the greatest of three numbers.

17

SPREAD SHEET

18

Ex. No.: 5 Date: AIM:

CHART LINE, XY, BAR AND PIE

To draw line, XY, bar and pie chart using MS-Excel. PROBLEM STATEMENT: Draw line, XY, bar and pie chart for the result analysis data (take subjects in x axis and pass percentage in y axis) given below
Subjects Pass Percentage S1 80 S2 90 S3 70 S4 70 S5 100 S6 80

ALGORITHM: Step 1: Open new document in MS-Excel. Step 2: Select the option chart and prepare line, xy, bar and pie chart for the result analysis. Step 3: Select the line chart and in x axis take subjects and in y axis take pass percentage. Step 4: Do the same for all the charts. Step 5: Save the document. Step 6: Close the document. BAR CHART: Result Analysis
S6 S5 Subjects S4 S3 S2 S1 0 50 100 150 Pass Percentage

Pass Percentage

19

LINE CHART:

Result Analysis
120 Pass Percentage 100 80 60 40 20 0 S1 S2 S3 S4 S5 S6 Subjects Pass Percentage

PIE CHART:

Result Analysis

S1 S2 S3 S4 S5 S6

20

XY CAHRT:

Result Analysis
120 Pass Percentage 100 80 60 40 20 0 0 2 4 Subjects 6 8 Pass Percentage

RESULT: Thus line, XY, bar and pie charts are prepared using MS-Excel. 21

Ex. No.: 6 Date: AIM:

FORMULA FORMULA EDITOR

To create a spread sheet to calculate the net pay of the employee and to create students report using Microsoft Excel. ALGORITHM: Step 1: Click Start program Microsoft Excel. Step 2: Type employee number, Name, basic pay, HRA, DA, LIC, PF, GPF, GS, DED, NET Pay . Step 3: HRA is calculated using the formula =0.18*Basic. Step 4: DA is calculated using the formula =0.56*Basic Step 5: For calculating TA, the formula is =0.12*Basic, for PF =0.10*basic, for GPF =0.05*Basic, For LIC =0.07*Basic Step 6: GS, DED, NET is calculated using the given formulas. GS= Basicpay+HRA+DA DED=LIC+PF+GPF NET=GS-DED Step 7: Data Sort is selected for sorting the data. Step 8: To create an examination database, enter the marks of the students in worksheet. Step 9: Calculate the total by giving the formula, =sum (mark1, mark2, mark3, mark4, mark5) and average is calculated using, =total/5. Step 10: Class is calculated using the formula =If (And (F2>=75, G2=PASS),DIS ,If (And (F2>=60,G2=PASS), First , If (And (F2>=50<60, G2=Pass),Sec,Third)))

22

OUTPUT: EMPLOYEES SALARY EMP NO NAME BASIC PAY 11700 11000 13000 13600 7000 8000 9000 HRA 2106 1980 2340 2448 1260 1440 1620 DA 6552 6160 7280 7616 3920 4480 5040 LIC 819 770 910 952 490 560 630 PF 1170 1100 1300 1360 700 800 900 GPF 585 550 650 680 350 400 450 GS 20358 19140 22620 23664 12180 13920 15660 DED 2574 2420 2860 2992 1540 1760 1980 NETPAY 17784 16720 19760 20672 10640 12160 13680

107 BALA 101 BHARATHI 103 JENNO 105 KIRUTHIKA 102 MEGALA 104 MOHANA 106 YUVARAJ

STUDENTS REPORT NAME M1 AA BB CC DD 55 74 66 34 M2 88 95 23 84 M3 84 74 34 57 TOTAL AVERAGE RESULT 227 243 123 175 76 81 41 58 PASS PASS FAIL FAIL CLASS DIS DIS THIRD CLASS SECOND CLASS

RESULT: Thus, a spread sheet was created to calculate the net pay of the employee and students report using Microsoft Excel

23

Ex. No.: 7 Date:

SPREAD SHEET INCLUSION OF OBJECTS, PICTURE AND GRAPHICS, PROTECTING THE DOCUMENT AND SHEET

AIM: To insert object, picture and protect the sheet using MS-Excel. ALGORITHM: Step 1: Open new MS-Excel document. Step 2: In the menu select Insert - > Object and select Bitmap from list. Step 3: Draw the diagram using paint tools in MS-Excel. Step 4: In the menu select Insert -> Picture -> Organization Chart. Step 5: To protect the sheet select in the menu Tools -> Protection -> Protect Sheet. Step 6: Enter the password for protection. Step 7: Save the file. Step 8: Close the file.

24

BEFORE PROTECTION OF SHEET:

AFTER PROTECTION OF SHEET:

RESULT: Thus object and picture are inserted and sheet is protected using MS-Excel Ex. No.: 8 Date: AIM: To import /export the content of the file and sort the content. SORTING AND IMPORT / EXPORT FEATURES

25

ALGORITHM: Step 1: Open new MS- Excel document. Step 2: Create a new text file using Start Run Notepad. Step 3: Create a name list of students in new notepad. Step 4: Save the text file. Step 5: Import the text file to the new spreadsheet using Data Get External Data Import Text file. Step 6: Insert marks for the imported students list. Step 7: Select the two columns and click Sort icon in the Tool Bar. Step 8: Save the excel file in other formats for Exporting. Step 9: Save and close the document. Imported Text before Sorting:
Name Harini Vidhya Anusha Balaji Anand Marks 78 80 80 75 65

After Sorting:
Name Anand Anusha Balaji Harini Vidhya Marks 65 80 75 78 80

RESULT: Thus text file is imported, exported and contents are sorted using MS-Excel and verified. .

26

C PROGRAMMING

9. DATA TYPES, EXPRESSION EVALUATION, CONDITION STATEMENTS. Ex. No.: 9.1 Date : AREA AND CIRCUMFERENCE OF THE CIRCLE

27

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 and circumference of the circle. Step - 3: Find the area and circumference of the circle using the formulae. Area=3.14*r*r Circum=2*3.14*r Step -4: Print the area and the circum of the circle. Step - 5: Stop the program.

OUTPUT: Enter the radius of the circle:5 Area of the circle=78.500000 Circumference of the circle=31.400000

RESULT: Thus, the program to find the area and circumference of the circle was executed and the output was verified.

28

Ex. No.: 9.2 Date: AIM:

CONVERTING THE CELSIUS INTO FAHRENHEIT

To write a program to convert the Celsius into Fahrenheit. ALGORITHM: Step-1: Start the program. Step-2: Enter the Celsius value. Step-3: Calculate the Fahrenheit value by using the formula given below Fahrenheit= (1.8*Celsius)+32 Step-4: Print the Fahrenheit value. Step-5: Stop the program.

OUTPUT: Enter the Celsius value=45 The given Farenheit value 45.000000 is converted into Celsius value =113.000000

RESULT: Thus, the program to convert from Celsius into Fahrenheit was executed and the output was verified.

29

Ex. No.: 9.3 Date: AIM:

SWAPPING WITHOUT THIRD VARIABLE

To write a C program for swapping two variables without third variables. ALGORITHM: Step 1: Start the execution of the program. Step 2: Declare the variables a & b. Step 3: Prompt for the input values. Step 5: Interchange the values using variables a and b alone. Step 6: Display the result. Step 7: Stop the program.

OUTPUT: Enter the two numbers : 2 4 Before Swap: a = 2, b = 4 After Swap: a = 4, b = 2

RESULT: Thus a C program swapping of a given number for expression evaluation is written, executed and verified.

30

Ex. No.: 9.4 Date: AIM:

IF-ELSE GREATEST OF THREE NUMBERS

To write a C program for find the greatest among three numbers. ALGORITHM: Step 1: Start the program. Step 2: Declare the variables a,b,c. Step 3: Find the greatest of three numbers a,b,c. Step 4: If a is greater than b and a is greater than c print the statement a is greater. Step 5: If a is not greater than b and if b is greater than c, print the statement b is greater. Step 6: Print c is greatest if step 4 & 5 is false. Step 7: Stop the program.

OUTPUT: Enter the three numbers : a = 4 b = 23 c = 8 b is the greatest among the three numbers.

RESULT : Thus a C program find the greatest of 3 numbers using if-else is written, executed and verified.

31

Ex. No.: 9.5 Date: AIM:

FOR LOOP FACTORIAL OF A NUMBER

To write a program to find the factorial of the given number. ALGORITHM: Step-1: Start the program. Step-2: Declare n and i as integer. Step-3: Initialize m as 1. Step-4: Enter the number n. Step-5: Using for loop find the factorial using m = m * i. Step-6: Increment the counter till n is reached. Step-7: Print the factorial of the given number. Step-8: Stop the program.

OUTPUT: Enter a number : 5 The factorial of 5 is 120

RESULT : Thus a C program to find the factorial of the given number using for loop is written, executed and verified.

32

Ex. No.: 9.6 Date: AIM:

FOR LOOP - PASCAL TRIANGLE

To write a program to print the Pascal triangle. ALGORITHM: Step-1:Start the program Step-2:Read input n Step-3: Initialize i to 0, check i<n else goto STEP10 Step-4:Initialize j to 0, check j<=n-i-2 else goto STEP6 Step-5: Print the space Step-6:Increment j by 1, goto STEP4 Step-7:Initialize 1 to j, check j<=i else goto STEP10 Step-8:Call function to print the number Step-9:Increment j by 1, goto STEP7 Step-10:Stop the program. Function Factorial Step-11:Initialize 1 to result,j, check j<n else goto STEP13 Step-12:calculate the result as result=result*c Step-13:Return result value

OUTPUT: Enter the number lines to print=4


1 1 1 1 2 1 1 3 3 1

RESULT: Thus, the program to print the Pascal triangle was executed and the output was verified.

33

Ex. No.: 9.7 Date: AIM:

WHILE LOOP GENERATING AMSTRONG NUMBERS

Write a C program to generate Amstrong numbers between 1 and 1000. ALGORITHM: Step-1: Start the program. Step-2: Intialise n, p, q, r, s, u, i as integers. Step-3: Assign the value 1 to i. Step-4: When i < 1000 then goto 6. Step-5: Stop the program. Step-6: Let p = n % 10, q= n / 10, r = q % 10, s = q / 10, u = p ^ 3 + r ^ 3 + s ^ 3. Step-7: When the n is equal to u then goto 9. Step-8: Print End. Step-9: Print n. Step-10: Stop the program. OUTPUT: 1 153 370 371 407

RESULT : Thus a C program to generate Amstrong numbers using while loop is written, executed and verified.

34

Ex. No.: 9.8

BINARY TO DECIMAL

AIM
To write a program to convert binary number to its decimal equivalent using while loop.

ALGORITHM
Step 1 : Start Step 2 : Read the binary value Step 3 : Initialize dec and i to 0 Repeat steps 47 until binary > 0 Step 4 : Extract the last digit using modulo 10 Step 5 : Calculate decimal = decimal + digit * 2i Step 6 : Recompute binary = binary / 10 Step 7 : Increment i by 1 Step 8 : Print decimal Step 9 : Stop

OUTPUT: Enter a binary number : 1101011 Decimal Equivalent is 107

35

Ex. No.: 9.9 Date: AIM:

WHILE LOOP REVERSE A NUMBER

Write a C program to reverse a number using While-Loop statement. ALGORITHM: Step 1: Start the program. Step 2: Declare n and a as integers. Step 3: Get the number as n. Step 4: In the do-while loop calculate n % 10 and assign the result to a. Step 5: Print the value of a. Step 6: Calculate n / 10 and assign the result to n. Step 7: Continue until n != 0. Step 8: Stop the program. OUTPUT : Enter the number : 2543 The reversed number is : 3452

RESULT : Thus a C program to reverse a number using While-loop is written, executed and verified.

36

Ex. No.: 9.10 Date: AIM:

DO WHILE LOOP FIBONACCI SERIES

Write a program for generating Fibonacci series of numbers. ALGORITHM: Step-1: Start the program. Step-2: Declare i, n, f1, f2 and f3 as integers. Step-3: Intialise f1 to 0 and f2 to 1. Step-4: Enter the limit of the series from the user. Step-5: Print the first two numbers of the series. Step-6: Calclulate f3as f3= f1+ f2 and print f3. Step-7: Increment i till the limit of the series using for loop and print the series. Step-8: Stop the program.

OUTPUT: Enter the limit of the series : 6 0 1 1 2 3 5 8 13

RESULT : Thus a C program to generate Fibonacci series of numbers using do while loop is written, executed and verified.

37

Ex. No. 9.11


AIM

SWITCH CASE -SIMPLE CALCULATOR

To write a menu driven calculator program using switch statement. ALGORITHM Step 1 : Start Step 2 : Display calculator menu options Step 3 : Read the operator symbol and operands n1, n2 Step 4 : If operator = + then calculate result = n1 + n2 Step 4.1 : Else if operator = then calculate result = n1 n2 Step 4.2 : Else if operator = * then calculate result = n1 * n2 Step 4.3 : Else if operator = / then calculate result = n1 / n2 Step 4.4 : Else if operator = % then calculate result = n1 % n2 Step 4.2 : Else print "Invalid operator" and go to step 6 Step 5 : Print result Step 6 : Stop

OUTPUT Simple Calculator + Summation - Difference * Product / Quotient % Remainder Enter the operator : Enter operand1 and operand2 : 2 4 2 - 4 = -2 Simple Calculator + Summation - Difference * Product / Quotient % Remainder 38

Enter the operator : * Enter operand1 and operand2 : 3 2 3*2=6 Simple Calculator + Summation - Difference * Product / Quotient % Remainder Enter the operator : % Enter operand1 and operand2 : 5 2 5%2=1

RESULT : Thus a C program to perform menu driven calculation using switch statement is written, executed and verified.

39

10. ARRAYS Ex. No.:.10.1 AIM: Write a program to print the ascending and descending order of the given array. ALGORITHM: Step --1:Start the program Step--2: Enter the size of the array Step--3: Enter the elements of the array Step--4: Set a loop upto the array size minus one Step--5:Set a inner loop upto the size of the array Step--6:Check whether the next array element is greater than or not Step--7: If greater than exchange their position Step--8: If not greater than then go to the loop Step-9:Print the ascending order of the given array Step--10: Print the descending order of the given array Step--11:Stop the program. ASCENDING AND DESCENDING ORDER USING ARRAYS

OUTPUT: Enter Upper limit6 Enter the numbers12 98 54 9 78 34 The ascending order of the given numbers The descending order of the given number 98 9 78 12 54 34 34 54 12 78 9 98

RESULT: Thus, the program for finding ascending and descending order using arrays was executed and verified.

40

Ex. No.:.10.2 Date: AIM:

SORTING THE ALPHABETS

Write a program to arrange names in alphabetical order. ALGORITHM: Step --1:Start the program Step--2: Enter the size of the array Step--3: Enter the elements of the array Step--4: Set a loop upto the array size minus one Step--5:Set a inner loop upto the size of the array Step--6:Check whether the next array element is greater than or not Step--7: If greater than exchange their position Step--8: If not greater than then go to the loop Step--9:Print the sorted order of the given array Step--10:Stop the program.

OUTPUT: How many names ? 4 Enter the 4 names one by one aishwarya suresh deepa divya Names in alphabetical order aishwarya deepa divya suresh

RESULT: To C program to arrange names in alphabetical order was written , executed and verified.

41

Ex. No.:.10.3 Date: AIM:

ADDITION OF TWO MATRICES

To write a program to add two matrices using arrays. ALGORITHM: Step--1: Start the program. Step--2: Enter the row and column of the matrix Step--3: Enter the elements of the A matrix Step--4: Enter the elements of the B matrix 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 the row Step--8: Set a inner loop upto the column Step--9:Add the elements of the A and B in column wise and store the result in C matrix Step--10: Stop the program. OUTPUT: Enter the rows and column of two matrices: 3 3 Enter the elements of A matrix: 1 2 3 4 5 6 7 8 9 Enter the elements of B matrix: 2 3 4 5 6 7 8 9 1 The elements of A matrix 1 4 7 2 5 8 3 9 15 2 5 8 3 6 9 5 11 17 3 6 9 4 7 1 7 13 10

The elements of B matrix:

The addition of two matrices:

RESULT:

42

Thus, the program to add two matrices was executed and the output was verified. Ex. No.:.10.4 Date: AIM: Write a C program to multiply matrix A of order m x n with matrix B of order n x l. ALGORITHM: Step 1 : Start the program Step 2 : Read the order of matrix A as m and n Step 3 : Read the order of matrix B as p and q Step 4 : If n != p then print "Multiplication not possible" and Stop Step 5 : Set up a loop and read matrix A elements Aij, i = 0 to m-1 and j = 0 to n-1 Step 6: Set up a loop and read matrix B elements Bij, i = 0 to p-1 and j = 0 to q-1 Step 7 : Initialize i to zero Step 8 : Initialize j to zero Step 9 : Assign 0 to Cij Step 10 : Initialize k to zero Step 11 : Compute Cij = Cij + Aik * Bkj Step 12 : Increment k by 1 Repeat steps 11 and 12 until k < n Step 13 : Increment j by 1 Repeat steps 913 until j < q Step 14 : Increment i by 1 Repeat steps 814 until i < m Step 15 : Set up a loop and print product matrix Cij, i = 0 to m-1 and j = 0 to q-1 Step 16 : Stop the program OUTPUT: Enter order of matrix A : 2 3 Enter order of matrix B : 3 2 Enter matrix A elements 111 111 Enter matrix B elements 22 22 22 Product matrix C 66 66 Enter order of matrix A : 3 3 Enter order of matrix B : 2 3 Matrix multiplication not possible MATRIX MULTIPLICATION

43

RESULT: Thus, the program to multiply two matrices was executed and the output was verified. 11. STRUCTURES AND UNIONS Ex. No: 11.1 Date: Aim:To write a program to print the student name, roll no, average mark and their grades. Algorithm:Step-1: Start Step-2: Initialize structure std with members Step-3: Read the number of students n Step-4: Setup for loop to get student number, name and six subjects marks Step-5: Read s[I].sno, s[I].name, s[I].m1.s[I].m6 Step-6: Calculate total by using the formula s[I].tot=s[I].m1+ +s[I].m6 Step-7: Calculate average by using the formula s[I].avg=s[I].tot/6 Step-8: Calculate their grades by using the following formulas: Check if s[I].m1<35 or .or s[I].m6<35 s[I].grade= F else Check if s[I].avg >=75 , s[I].grade= D else Check if s[I].avg <75 and s[I].avg >=60 , s[I].grade= F else Check if s[I].avg <60 and s[I].avg >=50 , s[I].grade= S else Check if s[I].avg <50 and s[I].avg >=35 , s[I].grade= T else Step-9: Print the student name, roll no, average and their grade Step-10: Stop the program. OUTPUT: Enter the number of students to process: 3 Enter student[1] number,name and 6subjects marks: 1 karthi 78 67 98 76 61 83 Enter student[2] number,name and 6subjects marks: 2 geetha 71 69 72 60 88 59 Enter student[3] number,name and 6subjects marks: 3 abi 56 60 45 76 51 60 MARK SHEET PROCESSING USING STRUCTURES

44

Student mark lists are: S.NO NAME TOTAL AVERAGE GRADE ---------------------------------------------------------1 2 3 karthi geetha abi 463 419 348 77.000000 69.000000 58.000000 B C D

RESULT:

45

Thus, the program to find the student name, roll no, average marks and their grades was executed and the output was verified.

46

Ex. No: 11.2 Date:

PAYROLL PROCESSING USING UNION

Aim:To write a program in C to prepare Employee Payroll using Union. Algorithm : Step-1: Start Step-2: Define a union emp containing members like name,emp id, bpay, DA, HRA, CCA, PF, grosspay & netpay with union variable namee[100](array of unions). Step-3: Accept the number of employees n. Step-4: Accept the details of the employees by accessing the members of the union by giving e[i].<member name> where I is the loop counter from 1 to n. Step-5: Repeat steps 6 to 8 for i=1 to n. Step-6: Compute e[i].DA ,e[i] .HRA, e[i] .CCA ,e[i] .PF for the ith employee. Step-7: Compute e[i].gross by summing the above four calculations for the ith employee. Step-8: Compute e[i].netpay by subtracting the PF from gross for the ith employee. Step-9: Continue looping for i. Step-10: Display the details of the employees in tabular format. Step-11: Stop. OUTPUT: Enter the number of employees: 2 Enter details.1.EMP ID: 133 NAME: RASAN BASIC PAY: 8000 2.EMP ID: 135 NAME: RAVI BASIC PAY: 6000 Employee Details EMPID NAME 133 RASAN 135 RAVI RESULT: Thus, the program to prepare Employee Payroll using Union was executed and the output was verified. 47 BASICPAY DA 8000 5680 6000 4260 HRA CCA PF 800 400 800 600 300 600 GROSS 15680 11760 NET 14880 11160

Ex. No.: 12.1 Date: AIM:

FUNCTIONS CALL BY VALUE

To write a C program to swap two values using function as call by value. ALGORITHM: Step 1: Start the program. Step 2: Initialize a and b as integer and assign the values for them. Step 3: Print a and b. Step 4: Call the function swapv. Step 5: Initialize t as integer. Step 6: Assign x to t, y to x and t to y. Step 7: Print the value of x and y. Step 8: Stop the program.

OUTPUT a=8 b=5 x=5 y=8

RESULT: Thus the C program for swapping two values using function as call by value is written, executed and verified.

48

Ex. No.: 12.2 Date: AIM:

FUNCTIONS CALL BY REFERENCE

To write a C program to swap two values using function as call by reference. ALGORITHM: Step 1: Start the program. Step 2: Initialize a and b as integer and assign the values for them. Step 3: Print a and b. Step 4: Call the function swap. Step 5: Pass the address of variables a and b as parameters to the function swap. Step 6: Declare x and y as integer pointers in the function. Step 7: Initialize t as integer. Step 8: Assign *x to t, *y to *x and t to *y. Step 7: Print the value of *x and *y. Step 8: Stop the program.

OUTPUT a=8 b=5 x=5 y=8

RESULT: Thus the C program for swapping two values using function as call by reference is written, executed and verified

49

Ex. No.:12.3 Date: AIM:

FUNCTIONS RECURSIVE FUNCTION

To write a C program to find GCD of two numbers using recursive function. ALGORITHM: Step 1: Start the program. Step 2: Initialize a, b and gcd. Step 3: Get the values for a and b. Step 4: Call the function fun_GCD. Step 5: Print the value of gcd. Step 6: Stop the program. fun_GCD: Step 1: Initialize rem as integer. Step 2: If y = 0 then return value of x to main else goto Step 3. Step 3: Assign result of x modulo y to rem. Step 4: Recursively call fun_GCD with y and rem as parameters. Step 5: Return the value obtained.

OUTPUT Enter the values of A and B: 12 8 The GCD of 12 and 8 = 4.

RESULT: Thus the C program for finding a GCD of two numbers using recursive function is written, executed and verified.

50

Вам также может понравиться