Professional Documents
Culture Documents
GE2115-Computer Practice Laboratory-I Manual-Rev01
GE2115-Computer Practice Laboratory-I Manual-Rev01
SRIPERUMBUDUR
LAB MANUAL
I SEMESTER
Prepared by Approved by
Signature
1
TABLE OF CONTENTS
Word Processing
1 Document creation, Text manipulation with Scientific
notations.
Word Processing
2 a. Table creation, Table formatting and Conversion
b. To create an advertisement in Word.
Word Processing
3 To illustrate the concept of mail merging and letter
preparation.
Word Processing
4 Drawing - flow Chart
Spread sheet
5 Chart - Line, XY, Bar and Pie.
Spread sheet
6 Formula - formula editor.
Spread sheet
7 Inclusion of object, Picture and graphics, protecting the
document and sheet. Auto Filtering
Spread sheet
8 Sorting and Import / Export features.
Data types, Expression Evaluation, Condition
Statements.
a. Round of an integer
b. Quadratic equation
c. Armstrong number
d. Palindrome Number
e. To write a program for electricity bill preparation.
9 f. To write a simple menu driven calculator program
using switch statement
g. To write a program to find the largest digit of a
number
h. To write a program to print the sine and cosine
series.
i. To write a program to generate prime numbers.
2
TABLE OF CONTENTS
Arrays
a. Linear Search
b. Bubble sort
c. Matrix addition
d. To write a program to perform Matrix
multiplication.
10 e. To write a program to input a 3x3 Matrix and
display it with the sum of the rows and columns.
f. To write a program to perform string
manipulation functions like string concatenation,
comparison, find the length and string copy
without using library functions.
g. To write a program to arrange names in
alphabetical order
Functions
a. To write a C program to calculate the mean,
variance and standard deviation using functions.
b. To write a C program to perform sequential and
12 binary search using functions
c. To write a program to print the Fibonacci
series using recursion
d. To calculate the factorial of the given number
using recursion
3
Ex no: 1
PART-A
‘Correction. You are in error. You are miss informing your father. Correction. The work
has not been done. Your computer has not been used. ERROR, ERROR”. The robot’s
voice was metallic.
TARUN: You are so lucky Adyta! Manku can do so many things. It can clean the house.
It can answer the telephone, call the doctor and it can even open the door.
ADITI: Wait! There are so many things it can’t do. It can’t laugh. It can’t do MY
HOMEWORK FOR ME. It can’t even help me decide what should I wear for the party.
• Go to file menu with cursor, select option ‘save’, then type ‘document.doc’ then
click save.
• The document is saved under that name
iii. Insert the following text before the conversation between Aditi and Tarun
“Oh! Stop interrupting, Manku”. Aditi said angrily. “You’re are not supposed to
participate in every conversation”
• Mark the heading with cursor and then click on the bold, italic and the letter size
icons.
• Click on the font icon and click on ms comic sans. The change is made.
4
vi. Select the heading of the document, cut and paste it at the end of the
document
• Select the heading and click the right button of cursor and choose cut
• Move the cursor to the end of the document, again click the right key and click
past.
• Select the heading; press the right button mouse, click cut.
• Move cursor to the top of the document and click paste.
viii. Select the first two lines of the paragraph and convert it to uppercase
• Select all the uppercase, goto format choose change case to lower case and vice
versa
x. Change the font style of the last paragraph 12 pts bold italic
• Select the last para and click on the 12 size and italic icon
xi. Copy this format to the first paragraph using format painter
xii. Highlight the second paragraph (Hint: use highlighter or formatting toolbar)
• Select file from main menu and click on ‘save as’ and types the name, the
document is copied.
5
xvi. Undo the above action and see the effect
• Select file from main menu. Click on document.doc and click delete.
PART-B
Select Format and then Paragraph, make the required changes specified above
The cursor is brought down to the end of the document and the sentence is
typed.
• Make 12 copies of the statement written above and apply all the text
Attributes
6
• Highlight the statement, right click the mouse button, select copy (or) select copy
from ‘edit’
• Using paste option 12 copies are made
• Choose the ‘Font’ option from format and give text attributes like style, change in
style etc.
iv. Using different tab stops type the following data in the next page of
MYBOOK.DOC
APEX POLYMERS
• Select format from main menu and choose tabs after going to the next page using
the cursor
• Fill the option ‘Tab stop position’ to be set for each heading and click set and
then ok
• So equal spacing will be given according to the position filled
vi. Search for the word ROBOT and replace it with ‘ROBOT machine’
vii. Write the following text in the next page of the same document
(MYBOOK.DOC)
7
If you cry nobody will cry with you but
If you laugh everybody will laugh with
you.
SO ALWAYS LAUGH
SO ALWAYS LAUGH
viii. Insert a page break before the conversation between Tarun and Aditi
ix. Open a new document and insert the table with the following data:
• Select Draw table from Table options and draw a table in the document
• Choose Split cells from Table, fill in Rows and Columns, fill in the data.
• Click on Save icon and give the name and then click Close in File menu
8
xi. Again open the document MYBOOK.DOC and got the end of the
document in one step
• Click the Open menu, type the name, when document appears, click Ctrl+End
xii. Print preview the page containing the drawing features and use the zoom
feature to view this in different percentages.
xiii. Use the auto correct feature of work to add short forms for:
I. AP Apex Polymers
II. V&A Vicky & Associates
III. BPL British Petroleum Limited
IV. PACE PACE Academy of Computer Education
V. IP Informatics Practices
xvi. Spell check your document an correct all the grammatical as well as
spelling mistakes
Part C
10
Ex no: 2a
Table creation, Table formatting and Conversion
i. Open a new document and insert a table with the following data:
• On the Table menu, point to Insert, and then click Table option.
• Type the number of rows and columns in the Insert Table dialogue
box.
• Or you can use the Draw Table tool from Table menu to create a
table. First, draw a line from one corner of the table to the corner
diagonally opposite in order to define the boundary of the entire table,
and then draw the column and row lines inside.
• Type the given data.
11
iv. Align the text in the first row to “Center” and align the text in the
remaining rows to “Left”.
• Block the text in the first row of the table by dragging the mouse
across it.
• Click on Center button on the Formatting toolbar.
• Block the text in the remaining rows.
• Click on Align Left button on the Formatting toolbar.
• Or on the Format menu, select Paragraph option.
• Select the options from the Alignment combo box in the Indents and
Spacing tab.
• Click OK button.
v. Insert a New Column to the beginning of the table with the following data.
S.No
1
2
3
4
5
• Use a mouse to place the cursor at the beginning column of the table.
• On the Table menu, point to Insert, and then click Columns to the
Left.
• Type the given data in the inserted column.
12
• Click OK button.
xi. Delete the third row and third Column from the table.
• Place the mouse cursor on the 3rd row.
• On the Table menu, point to Delete, and then select Rows.
• Place the mouse cursor on the 3rd Column.
• On the Table menu, point to Delete, and then select Columns.
xii. Create a new row at the top of your table, merge the cells, and add a title
to the table.
• Place the mouse cursor on the first row.
• On the Table menu, point to Insert, and then click Rows above.
• Block that row, by dragging the mouse across it.
• On the Table menu, click Merge Cells.
• Then type the title of the table.
13
• Select the cell, rows, or columns you want to add borders, shading
and color.
• Either right click within your table and choose Table properties or
click within your table and go to Table on the menu bar and choose
Table properties.
• The Table properties dialog box will open.
• Click on the Borders and Shading button.
• Choose the setting style, the color and the width that you want.
• Click OK then new settings will be added to the table.
• Or on the Table menu, click Table AutoFormat.
• In the Formats box, click the format you want.
• Then click OK button.
xvi. Spell check your document and correct all the grammatical errors as
well as spelling mistakes.
• On the Tools menu, click Spelling and Grammar Check option.
• The errors are shown in red colour.
• From the list of Suggestions choose one.
• Click change or ignore.
• Continue till all errors are rectified.
14
Ex no: 2b
ADVERTISEMENT
Abstract
A recent survey conducted jointly by •Aligning the offshore team with your
Outsourcing Center and Wipro organization’s culture and business
Technologies indicates companies still imperatives
have significant challenges in managing •Lack of a long-term strategy or vision
their captive offshore centers. for your captive offshore operation
•Lack of adequate management
The survey, which was not a scientific bandwidth to effectively manage the
study, polled visitors at the Outsourcing model
Center portal during May 2006. It asked
CIOs and Global Sourcing Managers to This discusses the survey’s findings as
choose which of the following four well as some best practices to combat the
factors is their key challenge in challenges of a captive offshore center. It
managing an offshore captive center: also discusses the trend of using a hybrid
model— part captive, part outsourcing—
•Rapid scalability of workforce and as the solution for these challenges.
infrastructure while maintaining the cost
advantage
15
To create the advertisement in word.
Sep 01,2008,
Chennai.
From
VENKATESH .P
Sri Ranga Apartments,
No: 120, II Avenue,
T. Nagar.
Chennai-17.
To
Dear Sir/Madam,
With the current slow down in hiring within the high- tech field, you must be flooded with
resumes from out-placed software engineers such as myself. Please take a moment to consider
my qualifications. I believe in particular is highly marketable in this tight market:
I worked on the team that pioneered the technology that put the PalmPilot on the map.
In today’s increasingly mobile society, this technology has places to go, and I have ideas that
could take us to the next step in office independence.
Please call me with prospective job opportunities. I am interested in a project management
position in the $95K range.
Thank you!
Venkatesh. P
Enclosure: Resume.
• Select Start menu
• Select Programs option
• Select Microsoft Word from Programs Sub menu.
• Select New option from the File menu of MS Word Window.
ii. Save the document as “Letter.doc.”
• Select File menu.
• Select Save option from File menu.
• Type the document name as “Letter.doc” in Filename textbox.
• Click the Save button.
Flowchart
A flowchart illustrates the steps in a process. By visualizing the process, a flowchart can quickly
help identify bottlenecks or inefficiencies where the process can be streamlined or improved.
Alternate Definition:
The flowchart is a means of visually presenting the flow of data through an information
processing systems, the operations performed within the system and the sequence in which they
are performed
MEANING OF A FLOWCHART
Flowcharts use special shapes to represent different types of actions or steps in a process. Lines
and arrows show the sequence of the steps, and the relationships among them.
Guidelines in Flowcharting:
a. In drawing a proper flowchart, all necessary requirements should be listed out in logical
order.
b. The flowchart should be clear, neat and easy to follow. There should not be any room for
ambiguity in understanding the flowchart.
c. The usual direction of the flow of a procedure or system is from left to right or top to
bottom.
d. Only one flow line should come out from a process symbol.
(OR)
e. Only one flow line should enter a decision symbol, but two or three flow lines, one for
each possible answer, should leave the decision symbol.
g. If the flowchart becomes complex, it is better to use connector symbols to reduce the
number of flow lines. Avoid the intersection of flow lines if you want to make it more
effective and better way of communication.
h. Ensure that the flowchart has a logical start and finish.
i. It is useful to test the validity of the flowchart by passing through it with a simple test
data.
1. Communication: Flowcharts are better way of communicating the logic of a system to all
concerned.
2. Effective analysis: With the help of flowchart, problem can be analysed in more effective
way.
3. Proper documentation are made
4. Efficient Coding are developed
5. Proper Debugging are made.
6. Efficient Program Maintenance is achieved.
1. Complex logic: Sometimes, the program logic is quite complicated. In that case,
flowchart becomes complex and clumsy.
2. Alterations and Modifications: If alterations are required the flowchart may require re-
drawing completely.
Example of a Basic Flowchart:
Exercises On Flowcharting:
Where N! = 1 ´ 2 ´ 3 ´ …… N .
Ex no: 5
Charts- Line, XY, Bar and Pie.
Problem 1:
A B C D E
1 Vehicle Jan Feb Mar Total
2 Car 250 300 310
3 Auto 54 92 20
4 Jeep 91 120 11
5 Van 125 119 78
6 Total
1. Make sure that appropriate formulas are entered in column E so that total sales of each
vehicle is shown properly. Similarly, in row 6 type correct formulas so that total sales for
each month is shown in respective columns.
2. Draw a Pie Chart to show vehicle wise total sales made between Jan and Mar 2004.
Total sales of each vehicle must be shown as a sector.
24%
Car
48% Auto
Jeep
18%
Van
10%
3. Draw a bar graph/column chart to show sale of vehicles for each month.
column chart
1000
Series1
total
500
Series2
0 Series3
Car Auto Jeep Van Total Series4
vehicles
4. Draw a stacked bar graph to show the sale of each vehicle in comparison with the total
sales for the month.
Total
Series1
Vehicles
Jeep Series2
Series3
Car
5. Draw a Line graph to show the sales trend over the first quarter of the year 2004.
Line Chart
1000
Car
Total
500 Auto
Jeep
0
Van
1 2 3 4
Total
months
F
1 Cost
2 200000
3 700000
4 900000
5 1000000
Draw an XY – graph comparing two numerical variables viz., cost of the vehicle and
sale of the vehicle.
1500000
1000000
Cost
Series1
500000
0
0 500 1000
Total
Problem 2:
Create title for the graph as ‘Sales Report for the first quarter – 2004’
1. Create legends for all the data ranges in the graphs/charts drawn in problem 1.
Line chart
Series1 Series2 Series3 Series4
1000
total
500
0
Car Auto Jeep Van Total
vehicles
Total Series1
Vehicles
Jeep Series2
Series3
Car
Problem 3:
1. To auto fill a range viz., A1..C5 with values starting from 1, increasing in steps of 5.
GLOBAL SOFT Company keeps the employees’ payroll data in a worksheet as shown below.
A B C D E
1 GLOBAL SOFT COMPANY
2 Emp No. Name Salary
3 1 Meena 24500
4 2 Vishal 10500
5 3 Elisa 14790
6 4 Richa 14000
7 5 Swetha 15250
8 6 Dravid 16000
9 7 Sourav 14100
10
i) Enter the above data in a worksheet and save the workbook as EMPLOYEE.XLS
ii) Calculate HRA, DA, PF and Net salary for each employee.
a. Type HRA, DA, PF, Net salary in cells D2, E2, F2 & G2.
b. Enter the formula (=C3*20/100) in cell D3 to calculate HRA.
c. Drag through the range you want and then press enter.
d. Similarly calculate DA, PF, Net salary for each employee.
The Hindustan departmental store has organized an Off Season sale. The details of the items on
sale and the percentage of discount offered are entered in a workbook as shown below.
A B C D E
1
HINDUSTAN DEPARTMENTAL STORE
i) Enter the given data in a workbook and save the workbook as HINDUSTAN.XLS
ii) Calculate the Selling Price of each item and display in column D of the sheet.
• Starting from cell A1, build the table with consumer number, name, type (H / C),
previous reading (PR), and current reading (CR).
• Calculate chargeable units (CU) using the formula CU= CR-PR
• Calculate the Cost/Unit using the above table by writing the formula using IF and
AND conditions in the formula bar.
• Calculate the amount as the product of CU and Cost/Unit.
PROBLEM 5:
PROBLEM 6:
Create an electronic spreadsheet for income tax calculation by entering name, gross salary and
savings
Upto 1.5 lacs ------ NIL
1.5 – 3 lacs ------- 10%
3 – 5 lacs ------- 20%
5 –25 lacs ------- 30% Calculate the taxable amount and tax for individual person.
Starting from cell A1, build the table with name, gross salary and savings. Find the taxable
amount
• Calculate the tax using the above conditions in the formula bar.
Ex no: 7
Select the Clip art option from Picture sub-menu of the Insert menu.
From the dialogue box displayed click on the graphic selected by you and click on the
Insert Clip to add the image to the worksheet.
Preview Clip to view the image full-size before adding it to the worksheet Drag the
bottom, right corner of the preview window to resize the image and click the "x" close
button to end the preview
Add Clip to Favorites will add the selected image to your favorites directory that can be
chosen from the Insert ClipArt dialog box.
Find Similar Clips will retrieve images similar to the one you have chosen.
Continue selecting images to add to the worksheet and click the Close button in the top,
right corner of the Insert ClipArt window to stop adding clip art to the worksheet
Choose the protect sheet command from the protection sub-menu of tools menu.
Type password and click on the ok button
Re enter the password to confirm that you have not made any mistake and click on the
OK button again.
Save and close the worksheet
Reopen the workbook using the file open command. Now if you try to edit the workbook
one message box will appear informing you that since the cells are protected you can’t
modify them.
Click on the OK button to close this message box..
To unprotect the document choose unprotect sheet command from the Protection submenu
of Tools menu.
Problem:
Create an EXCEL sheet for the student details in a class for grade calculation:
(i) Passed in all subjects (ii) Avg ≥ 90 grade is O, Avg ≥ 80 grade is A, Avg ≥ 70 grade is B,
Avg ≥ 60 grade is C, Avg ≥ 50 grade is D. Apply filtering options.
• Starting from cell A1, build the table with student number, name, marks for 3
subjects.
• Check the result of the student and display it. Calculate the average
• Calculate the grade using result and average in the formula bar.
To execute a basic descending or ascending sort based on one column, highlight the cells
that will be sorted .
Click the Sort Ascending (A-Z) button or Sort Descending (Z-A) button on the standard
toolbar.
Click on OK to execute the data sort command.
Select Import data option from Import External Data sub-menu of the Data menu.
Select the data source from the dialogue box displayed.
Click on OK to import.
Algorithm Description
1. Input the value of the integer to round off and store in integer variable i. Input the other
integer to whose multiple has to be rounded off to and store in integer variable j.
2. Round off the value of i to the next largest multiple of j and store the value in integer
variable k using the formula
k= i+j – i(mod)j
3. Print the value of variable k onto the screen.
4. Stop.
Sample Output
ENTER THE INTEGER TO BE RONDED OFF: 256
ENTER THE ANOTHER INTEGER: 7
THE RONDED OFF INTEGER IS 259
Algorithm Description
1. Input the co-efficients of the quadratic equation ax²+bx+c through the keyboard
and store the values in floating point variables a,b,c respectively.
2. Compute the value of b²-4ac and store in floating point variable d.
3. Check if the value of d is greater than 0. If it is, goto step 3, otherwise goto step 6
4. Compute 1st root and store in variable x1 using the formula
x1 = (-b + (d)½)/(-2a) and the other root in variable x2 using the formula
½)
x2= (-b - (d) /(-2a)
5. Print the values of the real roots x1 and x2 as the roots of the equation. goto step 11
6. Check if the value of d is less than 0. If it is, goto step 7 otherwise goto step 11
7. Compute the real part of the root and store in x1 using the formula
x1=-b/2a and the complex part in x2 using the formula
x2 = (-d)½/2a
8. Print the value of the complex roots onto the screen as x1 + ix2 and x1-ix2. Goto step 11.
9. Compute the equal roots and store in variables x1 and x2 using the formula
x1 = -b/2a and x2 = -b/2a
10. Print the values of the equal roots x1 and x2 onto the screen.
11. Stop.
Sample Output
ENTER THE COEFFIECIENTS
ENTER THE VALUE OF a: 2
ENTER THE VALUE OF b: 7
ENTER THE VALUE OF c: 4
THE ROOTS ARE -0.72,-2.78
Armstrong Number
Aim
Algorithm Description
1. Start.
2. Accept the number, N
3. Find the sum of the cube of the individual digits of the number N and store
in SUM1.
4. If SUM1 equals to N then N is Armstrong Else N is not Armstrong.
5. Stop
Sample Output
ENTER THE NUMBER: 153
THE GIVEN NUMBER 153 IS AN ARMSTRONG NUMBER
Palindrome Number
Aim
Algorithm Description
1. Start.
2. Accept the number, N
3. Find the reverse of the number N by extracting the last digit, multiplying by 10 and
reducing the number
4. If the reverse equals to N then N is a Palindrome Else N is not Palindrome.
5. Stop
Sample Output
ENTER THE NUMBER: 121
THE GIVEN NUMBER 121 IS A PALINDROME NUMBER
Aim
To write a C program to calculate electricity bill. Read the starting and ending meter reading.
The charges are as follows.
Algorithm Description
1. Get the initial and final meter reading from the consumer card.
2. No of units consumed=final meter reading-initial meter reading
3. If (no of units consumed >=200 && no of units consumed <=500) then
total charge =No of units consumed*3.50
4. If (no of units consumed >=100 && no of units consumed <=199) then
total charge =No of units consumed*2.50
5. If(no of units consumed <100) then total charge =No of units consumed*1.50
6. Print the total charge for the calculated no of units consumed.
Sample Output
No of units consumed=50
Total charge(Rs)=75
Ex no: 9f
Aim
Algorithm Description
1. Get two operands and the operator character from the user.
2. If the operator is ‘+’ then add the operands.
3. If the operator is ‘-’ then subtract one operand from the other operand.
4. If the operator is ‘*’ then multiply the operands
5. If the operator is ‘/’ then divide one operand by the other.
6. If the entered character is not matching any of these above four operators then print the
default statement “Enter the correct operator”
Sample Output
8
Ex no: 9g
Algorithm Description
1. Start
2. Read the value of n.
3. Assign max to 0.
4. Extract digit by digit and compare it with max.
5. Display the largest digit.
6. Stop
Sample Output:
Largest digit : 5
Ex no: 9h
Aim
1.Get the values of x and n where n decides how long the series should continue.
2.Set the initial conditions S=x, term=x,i=1
3.To get the terms with alternate sign repeatedly execute sign=-sign
4.Till the desired no of terms are generated repeat the following steps
a. Identify the current ith term
b.generate current term from its predecessor.
current ith term = (previous term)*x2 / i*(i-1)
c.add current term with the appropriate sign to the accumulated sum for
the sine function
i=i+2
term=-term* x2 / i*(i-1)
S=S+term
Sample input:
Sample output
0.8333333
Cosine Series
Sample input:
Sample output
4
Ex no: 9i
Algorithm Description
1. Start
2. Read the value of n.
3. To print the value 2 on screen.
4. Make a for loop
Declare i=3
Increment i by 1 upto n
5. Using another for loop
Declare j=2
From j=2 to j<i; divide i by j
If i % j = = 0 then print the number else print (“ “)
6. Stop
Sample Output:
2
3
5
7
Ex no: 10a
Linear Search
Aim
To search for a given element in an array and find its position if it is present.
Algorithm Description
1. Start
2. Accept the number of elements, n
3. Read all the n elements in the array a[n]
4. Accept the element, s, to search.
5. Initialize variables big and small to a[0] and posn to –1.
6. For i = 0 to n-1 do step 7
7. if (s==a(i)) then posn = i
8. if (posn>-1) then print “The given element is found at position :” , posn
9. if (posn==-1) then print “The given element is not found in the array”
10. Stop
Sample Output
Enter No of elements: 3
Enter Array elements: 2,6,9
Enter Searching element: 6
Bubble Sort
Aim
Algorithm Description
1. Start
2. Accept the number of elements, n, in the array.
3. For i = 0 to n-1 do step 4
4. Read a(i)
5. For i = 0 to n-1 do steps 6 to 10
6. For j = 0 to n-i-1 steps 7 to 10
7. if (a(j)>a(j+1)) do steps 8 to 10
8. temp = a(j)
9. a(j) = a(j+1)
10. a(j+1) = temp
11. For i = 0 to n-1 do step 12
12. Write a(i)
13. Stop
Sample Output
After Sorting:
2
4
6
10
Ex no: 10c
Matrix Addition
Aim
Algorithm Description
1. Start.
2. Accept the number of rows and columns (m,n , p,q) for the 2 matrices a & b.
3. If m<>p && n<>q then write “Matrix addition is not possible.” goto Step 13.
4. Accept the elements of the 2 matrices.
5. Repeat Steps 5 to 8 for i = 1 to m.
6. Repeat Steps 6 to 7 for j = 1 to q.
7. c[i][j]=a[i][j]+b[i][j]
8. Continue looping for j.
9. Continue looping for i.
10. Display “ The resultant matrix is”
11. Display the matrix c.
12. Stop.
Sample Output
Matrix Multiplication
Aim
Algorithm Description
1. Start.
2. Accept the number of rows and columns (m,n , p,q) for the 2 matrices a & b.
3. If n<>p then write “Matrix multiplication is not possible.” And goto Step 14.
4. Accept the elements of the 2 matrices.
5. Repeat Steps 6 to 11 for i = 1 to m.
6. Repeat Steps 7 to 10 for j = 1 to q.
7. Repeat Steps 8 & 9 for k = 1 to n.
8. c[i][j]=c[i][j]+a[i][k]* b[k][j].
9. Continue looping for k.
10. Continue looping for j.
11. Continue looping for i.
12. Display “ The resultant matrix is”
13. Display the matrix c.
14. Stop.
Sample Output
To write a program in C to input a 3x3 Matrix and display a Matrix with the sum of the rows and
columns.
Algorithm Description
1. Start.
2. Input the elements of the matrix
3. Find the row wise and column wise total and store it in separate one-dimensional
matrices
4. Display the given matrix along with the two one dimensional matrices in the required
format.
5. Stop.
Sample Output
Algorithm Description
1. Start.
2. Enter the two strings ,s1 and s2
3. Display the menu
1. String Concatenation
2. String Comparison
3. String length
4. String Copy
4. Accept the choice, ch from the user
5. if ch==1 goto step 6 else goto step 13
6. for i=0 to s1[i]<>’\0’ do step 7
7. concat[i]=s1[i]
8. concat[i]=’ ‘
9. for j=0 to s2[j]<>’\0’ do step 10
10. concat[i+j+1]=s2[j]
11. concat[i+j+1]=’\0‘
12. print the concatenated string as concat
13. if ch==2 goto 14 else goto step 20
14. initialize i=0
15. while(s1[i]==s2[i] && s1[i]<>’\0’&& s2[i]<>’\0’) do step 16
16. increment i by 1
17. if s1[i]==’\0’ && s2[i]==’\0’) do step 18
18. print the strings are equal
19. else print not equal
20. if ch==3 goto 21 else goto step 25
21. initialize count=0,i=0
22. while s1[i]<>’\0’do step 23
23. increment count by 1 and i by 1
24. display the length of the string as count –1
25. for i=0 to s1[i]<>’\0’ do step 26
26. copy[i]=s1[i]
27. copy[i]=’\0’
28. display the copied string as copy
Sample Output
Enter the two strings
New
York
1. String Concatenation
2. String Comparison
3. String length
4. String Copy
1. String Concatenation
2. String Comparison
3. String length
4. String Copy
1. String Concatenation
2. String Comparison
3. String length
4. String Copy
1. String Concatenation
2. String Comparison
3. String length
4. String Copy
Sorting Of Names
Aim
Algorithm Description
1. Start.
2. Accept the number of names, n, in the array.
3. For i = 0 to n-1 do step 4
4. Read a(i)
5. For i = 0 to n-1 do steps 6 to 10
6. For j = 0 to n-i-1 steps 7 to 10
7. if (strcmp(a(j),a(j+1)) >0) do steps 8 to 10
8. strcpy(temp, a(j))
9. strcpy(a(j) , a(j+1))
10. strcpy(a(j+1) , temp)
11. For i = 0 to n-1 do step 12
12. Write a(i)
13. Stop
Sample Output
Alphabetical List
Delhi
London
Moscow
Paris
Ex no: 11a
Algorithm Description
1. Start
2. Define a structure stu containing members like name, roll number, mark1,
mark2, mark3, total, average & grade with structure variable name
s[100](array of structures).
3. Accept the number of students n.
4. Accept the details of the students by accessing the members of the structure by
giving s[i].<member name> where I is the loop counter from 1 to n.
5. Repeat steps 6 to 8 for i=1 to n.
6. Compute s[i].total by summing the 3 marks and the average for the ith student.
7. Depending on the value of average, compute the grade for the ith student.
8. Continue looping for i.
9. Display the details of the students in tabular format.
10. Stop.
Sample Output
Student Details
ROLL NO NAME TOTAL AVG. GRADE
22 san 287 95 A
12 wer 143 47 C
Ex no: 11b
To write a program in C for finding the difference between two dates using structures.
.
Algorithm Description
1. Start
2. Define a structure date containing members like day, month, year.
3. Define 3 structure variables for date, say, d1, d2 and d3.
4. Accept the details of the dates for d1 and d2 by accessing the members of the structure
using d.<member name>
5. Find the difference and store it in d3.
6. Stop.
Sample Output
Enter date1: 18
04
2010
Enter date2: 12
02
2010
Difference in days: 6
Difference in Months: 2
Difference in year: 0
Ex no: 11c
Algorithm Description
1. Start
2. Define a union emp containing members like name,
emp id,bpay,DA,HRA,CCA,PF,grosspay & netpay with union variable name
e[100](array of unions).
3. Accept the number of employees n.
4. Accept the details of the employees by accessing the members of the union by
giving e[i].<member name> where I is the loop counter from 1 to n.
5. Repeat steps 6 to 8 for i=1 to n.
6. Compute e[i].DA ,e[i] .HRA, e[i] .CCA ,e[i] .PF for the ith employee.
7. Compute e[i].gross by summing the above four calculations for the ith
employee.
8. Compute e[i].netpay by subtracting the PF from gross for the ith employee.
9. Continue looping for i.
10. Display the details of the employees in tabular format.
11. Stop.
Sample Output
Employee Details
Aim
To write a C program to calculate the mean, variance and standard deviation using functions.
Algorithm Description
1. Start.
2. Enter the number of elements, n
3. Store the elements in an array, a[i]
4. call the function,mean(a,n) to calculate the mean
5. call the function, variance(a,n) to calculate the variance
6. square root of variance is the Standard deviation, sd=sqrt(variance)
7. Display mean, variance and standard deviation
8. Stop
Function mean(a,n)
1. Start
2. initialize sum=0
3. for i=1 to n do step 4
4. sum=sum+a[i]
5. m=sum/n
6. return m
7. stop
Function variance(a,n)
1. Start
2. x=mean(a,n)
3. for i=0 to n do step
4. sum=sum+(a[i]-x)*(a[i]-x)
5. var=sum/n
6. return var
7. Stop
Sample Output
Algorithm Description
1. Start.
2. Accept the limit ,n
3. Read all the n elements in the array a[n]
4. Accept the element, s, to search.
5. call the function, seq(a,s,n) for sequential search
6. call the function, bin(a,s,n) for binary search
7. Stop
Function seq(a,s,n)
1. Start
2. Initialize variables big and small to a[0] and posn to –1 respectively.
3. For i = 0 to n-1 do step 4
4. if (s==a(i)) then posn = i
5. if (posn>-1) then print “The given element is found at position :” , posn
6. if (posn==-1) then print “The given element is not found in the array”
7. Stop
Function bin(a,s,n)
1. Start
2. Initialize left=0 right =n
3. while left<=right do step 4
4. mid=floor((right-left)/2)+left
5. if value > a[mid] ,left=mid +1
6. else if value < a[mid], right=mid-1
7. else return mid
8. else return not found
9. Stop
Sample Output
Enter No of elements: 3
Enter Array elements: 2,6,9
Enter Searching element: 6
Algorithm Description
1. Start.
2. Accept the limit ,n
3. call the function, fib(n)
4. Print the series
5. Stop
Function fib(n)
1. Start
2. if n==1 return 0
3. else if n==2 return 1
4. else f(n)=fib(n-1)+fib(n-2)
5. return f(n)
6. Stop
Sample Output
Aim
Algorithm Description
1. Start
2. Enter the number,n for which the factorial has to be calculated
3. call the function, fact(n)
4. Print the factorial of the number
5. Stop
Function fact(n)
1. Start
2. if n==1 return 1
3. else f=n*fact(n-1)
4. return f
5. Stop
Sample Output