8/3/2019 focoldmanual
1/44
CK COLLEGE OF ENGINEERING & TECHNOLOGY
(A unit of CavinKare Academy)(Approved by AICTE, New Delhi & Affiliated to Anna
University)
Jayaram Nagar, Chellangkuppam, Cuddalore
BACHELOR OF COMPUTER SCIENCE AND
ENGINEERING
GE2115 Computer Practice Lab - I
SEMESTER I
Prepared by
CSE Dept.
8/3/2019 focoldmanual
2/44
CK COLLEGE OF ENGINEERING & TECHNOLOGY
COMPUTER PRACTICE-I LABORATORY
LIST OF EXERCISES
a) Word Processing
1. Document creation, Text manipulation with Scientific notations.
2. Table creation, Table formatting and Conversion.
3. Mail merge and Letter preparation.
4. Drawing - flow Chart
b) Spread Sheet
5. Chart - Line, XY, Bar and Pie.
6. Formula - formula editor.
7. Spread sheet - inclusion of object, Picture and graphics, protecting the
Document and sheet.8. Sorting and Import / Export features.
Simple C Programming
9. Data types, Expression Evaluation, Condition Statements.
10. Arrays
11. Structures and Unions
12. Functions
8/3/2019 focoldmanual
3/44
MICROSOFT
WORD
8/3/2019 focoldmanual
4/44
MICROSOFT WORD
Word processor is used to produce documents for business or personal
use such as newsletter, reports, letters and essays. We might say that a word
processor is an intelligent typewriter. We can type a whole page, make
corrections (editing), use up paragraphs in different styles and shapes and
columns (formatting) and also check spelling, find and insert synonyms for a
word (Thesaurus) and process it in many more ways before we actually put
that page to print.
FEATURES OF WORD PROCESSOR
The following are the main features of a word processor:
Fast
Editing features
Permanent storage
Formatting features
Graphics
8/3/2019 focoldmanual
5/44
CREATING A WORD DOCUMENT
AIM:
To create a Document, Text Manipulation with Scientific Notation in
M.S Word
PROCEDURE:
To enter Microsoft word, Click start button then click program
from programs menu then click Microsoft word
For opening a word document do the following. Click file menu
from the menu bar. From this file menu click new option. This willdisplay the new document.
Then for the newspaper format there must be a header and footer for
giving heading and page number. This is done by clicking view
from the menu bar, from this click header and footer option.
Then enter the heading in the header portion and change the font
size to big size and then click B button on formatting tool bar so
that the header appears bold.
Divide page into columns by clicking the format from the menu bar.
Then click columns from the menus available under format. In this
step the page is divided into your optional columns.
Then enter the text. To insert a picture in between the text, click
insert from the menu, then click picture and then clip art. From this
clip art we can insert any picture.
To insert symbols that are not found in the keyboard, click insert
from the menu, then click symbols.
8/3/2019 focoldmanual
6/44
After adding the text to the document, save the document by clicking
the file from the menu bar and click save .When we save the
document for the first time name is to be entered and click save
EXERCISE 1: Create a Document, Text Manipulation with Scientific
Notation in M.S Word
THE HINDU
FAKE STAMP PAPERS SEIZED
Two persons were arrested and counterfeit stamp papers seized
following a raid conducted on a house in coimbatore
A release here said a special team The team also found
Found counterfeit stamp papers of counterfeit currency.
Value Rs50000 and Rs1000.
Text Manipulation
God is great
Prevention is better than cure
Union is strength
Scientific Notation
(a+b)(a-b)=a2-b2
(a+b)2=a2+b2+2ab
2H2+O2->2H2O
CREATING A TABLE
8/3/2019 focoldmanual
7/44
AIM:
To create a table, table format and table conversion using Microsoft
word.
PROCEDURE:
To enter Microsoft word, Click start button then click program
from programs menu then click Microsoft word
For opening a word document do the following. Click file menu
from the menu bar. From this file menu click new option. This will
display the new document.
Enter the heading, change the font size. Click the B button on the
formatting tool bar so that the heading appears bold.
To change the font colors clickA button on the drawing tool bar and
select the required colors.
To insert a table click Table from the menu, then click insert, then
click table. Specify the required number of rows and columns and
the table gets inserted.
After adding the text to the document, save the document by clicking
the file from the menu bar and click save .When we save the
document for the first time name is to be entered and click save
Now the document has been created successfully.
EXERCISE 1: Create a table having the following details: Student number,
name and marks.Mark1 and Mark2 are the two columns that should be in the
marks column.
CREATE A MERGED DOCUMENT
8/3/2019 focoldmanual
8/44
AIM:
TO create a merged document using Microsoft word.
PROCEDURE:
To enter Microsoft word, Click start button then click program
from programs menu then click Microsoft word
Click Tools from the menu and choose Letters and mailings, then
click mail merge from it.
Then proceed with the following six steps to create a merged
document.1. From the list of document types available choose letters
2. Select current document as the starting document
3. Then select the recipients from the list. If the list is already
available choose Use an existing list otherwise choose Type
a new list and type the names & addresses of recipients
4. Write the content of the letter. To add recipient information to
the letter, click a location in the document and then click
Address block
5. One of the merged letter will be previewed and to preview
another letter click one of the following:
6. On clicking complete the mail merge mail merge is ready to
produce the letters
Now the document has been created successfully.
EXERCISE 1:
Using mail merge send the following letter to 5 of your friends.
8/3/2019 focoldmanual
9/44
From
Anto,
B-62,13th cross street,
Rose apartments,
Ambattur,
Chennai.
To
Dear,
Sub: Invitation for party.
I hereby invite you and your family members for the 25th anniversary
of my parents that is to be held on 28-11-2008 at our home. Please do come
and share with us our joy. I will be disappointed in your absence.
Yours lovingly,
EXERCISE 2:
A college wants to invite all the old students for its old students association
to be held in the college. Prepare a mail merged letter, in which only the
address changes for every student and the body of the letter remains
unchanged.
FLOWCHARTAIM:
8/3/2019 focoldmanual
10/44
TO create a flowchart using Microsoft word.
PROCEDURE:
To enter Microsoft word, Click start button then click program
from programs menu then click Microsoft word
For opening a word document do the following. Click file menu
from the menu bar. From this file menu click new option. This will
display the new document.
Enter the heading, change the font size. Click the B button on the
formatting tool bar so that the heading appears bold.
To change the font color clickA button on the drawing tool bar andselect the required colors.
Click Autoshapes option from the drawing tool bar, then click
flowchart and all the shapes will appear on the screen.
Select the needed shapes one by one and place it on the screen. To
connect all the boxes use flow lines from the drawing tool bar.
To add text inside the shape, select the particular shape and right click
the mouse button. Then a menu appears on the screen, select add
text from the menu. Now the cursor appears inside the shape and
allows us to enter the text.
Now the flowchart has been created successfully.
Exercise 1:
Draw a flowchart to calculate the simple interest.
Exercise 2:
Draw a flowchart to find the factorial of a given number using function.
8/3/2019 focoldmanual
11/44
MICROSOFT
EXCEL
MS-EXCEL
8/3/2019 focoldmanual
12/44
An electronic spreadsheet or spreadsheet is a table of rows and
columns into which data is entered. Spreadsheet software makes it
possible to enter data into a task format, manipulate, store, print
and create reports and graphics using them.
Microsoft Excel is the most widely used and versatile
spreadsheet package and lets you to organize your data into lists
and then summarize, compare and present the data graphically. It
has the user interface features common to other Microsoft office
applications.
MS-EXCEL allows you to
Enter and edit data in a worksheet
Use functions and formulae to calculate and analyze data
Create colorful charts and graphs
Save time by combining a series of commands into a single
command by using MACROS
CHART CREATION
8/3/2019 focoldmanual
13/44
AIM:
TO create a chart for the given data.
PROCEDURE:
To enter Microsoft Excel, Click start button then click program
from programs menu then click Microsoft Excel
For opening a word document do the following. Click file menu
from the menu bar. From this file menu click new option. This will
display the new work sheet.
Enter the data by placing the mouse pointer in a cell and a double
click on it. Use the tab key to switch from one cell to another.
To insert charts select the data to which the chart should be created.
Now click insert chart icon. A window will appear and select the
appropriate chart from it. Click next and enter the title, category(x)
axis, category(y) axis etc. Click finish button.
Then the appropriate chart is placed in the worksheet.
EXERCISE 1:
8/3/2019 focoldmanual
14/44
Compare the population (in the year 2007 and 2008) in the main cities
in India using various charts.
EXERCISE 2: Using various Charts compare the performance of 3
students in their examination. Create Line, XY, Bar, Pie charts for the
following data
NAME MARK1 MARK2 MARK3
Anto 96 85 45
Ignatius 80 59 85
Griffin 78 89 45
FORMULA EDITOR
AIM:
8/3/2019 focoldmanual
15/44
To calculate HRA, DA, TA, PF, GPF, LIC, Gross salary, Deductions, Net
salary from the given data in a worksheet.
ENO Name Basic HRA TA DA LIC PF GPF GS DED NET
1 Abc 2000
0
2 Asd 1500
0
3 Bfr 1000
0
4 Cde 7820
5 Erg 4569
WhereHRA is 18% of basic
DA is 15% of basic
TA is 12% of basic
PF is 10% of basic
GPF is 5% of basic
LIC is 7% of basic
GS (Gross salary) =Basis+HRA+DA+TA
DED (Deduction) =PF+GPF+LIC
NET (Net salary) =GS-DED
PROCEDURE:
8/3/2019 focoldmanual
16/44
To enter Microsoft Excel, Click start button then click program
from programs menu then click Microsoft Excel
For opening a word document do the following. Click file menu
from the menu bar. From this file menu click new option. This will
display the new work sheet.
Enter the data by placing the mouse pointer in a cell and a double
click on it. Use the tab key to switch from one cell to another.
For putting formulas, for eg,place the cursor on a cell which you have
to calculate the value of HRA, then type
=cell position of basic*18% and press enter.
Now the value of HRA is calculated. Similarly do for all others.
Calculate the same for other columns and drag them to all the cells.
Now the entire table is ready in spreadsheet.
8/3/2019 focoldmanual
17/44
SPREAD SHEET-INCLUSION OF OBJECT, PICTURE &
GRAPHICS, PROTECTING THE DOCUMENT
AIM:
i. Insert object in the worksheet
ii. Insert picture in the worksheet
iii. Protect a sheet
PROCEDURE:
To enter Microsoft Excel, Click start button then click program
from programs menu then click Microsoft Excel
For opening a word document do the following. Click file menu
from the menu bar. From this file menu click new option. This will
display the new work sheet.
For inserting object in the worksheet, choose objects option in the
insert menu
For inserting picture in the worksheet, choose Picture option in theinsert menu
For protecting your worksheet, choose Protection option from Tools
menu, then choose Protect Sheet option, Protect sheet dialog box
appears. Type a password and press enter.
Now your worksheet is protected and can be entered only with the
password.
8/3/2019 focoldmanual
18/44
SORTING AND IMPORT/EXPORT FEATURES
AIM:
i. Sort the given data in the worksheet
ii. Include Import/export features
PROCEDURE:
To enter Microsoft Excel, Click start button then click program
from programs menu then click Microsoft Excel
For opening a word document do the following. Click file menu
from the menu bar. From this file menu click new option. This will
display the new work sheet.
Select the data to be sorted and select data from the menu and click
sort
Specify the order in which the data are to be sorted (ascending or
descending) and click OK. Then the sorted data appears in the sheet.
To import a file select Insert->object->create from file
To export a file while saving the file save it as webpage so that it can
be viewed by internet explorer
8/3/2019 focoldmanual
19/44
EXERCISE 1:
Sort the given data in ascending and descending order (consider the name).
NAME MARK1 MARK2 MARK3Anto 96 85 45
Ignatius 80 59 85
Griffin 78 89 45
EXERCISE 2:
Sort the list of 10 students according to their average where
Average=M1+M2+M3+M4+M5
8/3/2019 focoldmanual
20/44
C PROGRAMMING
8/3/2019 focoldmanual
21/44
EX:NO:1 SIMPLE AND COMPOUND INTEREST
DATE :
Aim:
To write a C program to find the Simple Interest and Compound
Interest.
Algorithm:
Step1: Start the Program.
Step2: Declare the data type and variable.
Step3: evaluate the Simple Interest and Compound Interest.
Step4: Exit the program.
Program:
#include
#include
#include
void main()
{
int p,n,r;
float si,ci;
clrscr();
printf( Enter the value of P:\n);
scanf(%d, &p);
printf( Enter the value of N:\n);
scanf(%d, &n);
printf( Enter the value of R:\n);
scanf(%d, &r);
si = p*n*r/100;
ci = si+p;
printf(Simple Interest : %f, si);
printf(Compound Interest : %f, ci);
getch();}
8/3/2019 focoldmanual
22/44
Input and Output:
Enter the value of P: 4
Enter the value of P: 5
Enter the value of P: 6
Simple interest: 1.200000
Compound interest: 1016.0000
Result:
Thus the Simple and Compound interest found successfully.
8/3/2019 focoldmanual
23/44
EX:NO:2 SWAP USING TWO VARIABLES
DATE :
Aim:
To write a C program to perform swapping two variable without using
temporary variable.
Algorithm:
Step 1: Read the two numbers a & b
Step 2: Perform
2.1 a = a + b;
2.2 b = a - b;
2.3 a = a - b;
Step 3: Print the numbers a and b
Program:
#include
#include
Void main()
{
int a,b;
Printf(enter the value for a,b);
Scanf(%d%d,&a,&b);
a = a + b;
b = a - b;a = a - b;
printf(The value of a=%d,a);
printf(the value of b=%d,b);
}
8/3/2019 focoldmanual
24/44
Input and Output:
Enter the value of a and b: 56 75
The value of a =75
The value of b =56
Result:
Thus the program has been executed successfully.
8/3/2019 focoldmanual
25/44
EX:NO:3 QUADRATIC EQUATION
DATE :
Aim:
To find the given number is real or complex.
Algorithm:
Step1: Start the program.
Step2: Declare the required variable.
Step3: Cut the co-efficient of a,b,c from the user.
Step4: Find the value of d using formula.
Step5: If d>0 then print roots are real and not equal and find value of
x1,x2.
Step6: If d=0 then print roots are real and not equal and find value of x.
Step7: Otherwise print roots are complex.
Step8: Stop the program.
Program:
#include
#include
#includevoid main()
{
float a,b,c,d,x1,x2,x;
clrscr();
printf(Enter the co-efficient of a,b,c\n);
scanf(%f%f%f , &a,&b,&c);
d= b*b - 4*a*c;
if (d>0)
{x1 = -b+sqrt(d)/2*a;
x2 = -b-sqrt(d)/2*a;
printf(Roots are real and not equal\n);
printf(%f%f,x1,x2);
}
else if(d>0 )
8/3/2019 focoldmanual
26/44
{
x= -b/2 * a;
printf(Roots are complex\n);
printf(%f, x);
}
else
printf(Roots are complex);
getch();
}
Input and Output:
Enter Co-efficient of a,b,c
98
6
Roots are real and not equal: -36.000000
Result:
The program is executed and output is verified.
8/3/2019 focoldmanual
27/44
Ex. No: 4 PALINDROME OR NOT
Date :
Aim:
To write a C program to find the given string is palindrome or not.
Algorithm:
STEP-1 :- Start.
STEP-2 :- Read input,copy,condition,length,i.
STEP-3 :- To find length of string use length=strlen(input).
STEP-4 :- for(i=0;i
8/3/2019 focoldmanual
28/44
input[i] = toupper(input[i]);
}
strcpy(copy,input);
strrev(input);
condition = strcmp(input,copy);
if(condition = = 0)
printf("\nThe given input is palindrome");
else
printf("\n The given input is not palindrome");
getch();
}
Input and Output:Enter the input:mam
The given input is palindrome
Enter the input:dog
The given input is not palindrome
Result:
Thus the C program has been executed successfully
8/3/2019 focoldmanual
29/44
Ex. No: 5 PRIME NUMBER OR NOT
Date :
Aim:
To write a C program that prints the given number is prime or not.
Algorithm:
STEP-1 :- Start.
STEP-2 :- Read num,temp=2,k.
STEP-3 :- While(temp
8/3/2019 focoldmanual
30/44
getch();
}
Input and Output:
Enter the number:7
The number is prime
Enter the number:4
The number is composite
Result:
Thus the C program has been executed successfully
8/3/2019 focoldmanual
31/44
Ex. No:6 CALCULATE AND DISPLAY AVERAGE OF 10INTEGERS
Date:
Aim:
To write a program to calculate and display the average of 10 integer
number using
Algorithm:
1. Declare the required variables
2. Perform the operation using for loop to calculate the total ,average of
given ten number
3. Print the result
4. Terminate the program
Program:
#include
#include
Void Main()
{
Int a[10],s=0,avg=0,i ;
Printf(enter the ten numbers:\n);
For(i=0;i
8/3/2019 focoldmanual
32/44
Input and Output:
Enter the ten numbers:
21
12
12
45
78
8
56
3645
54
Sum=367
Avg=36
8/3/2019 focoldmanual
33/44
Result:
Thus the C program has been executed successfully
Ex. No: 7 MATRIX ADDITION
Date :
Aim:
To write a C program to implement matrix addition.
Algorithm:
Step1: Start the program.
Step2: Declare the two Dimensional array to get the matrix from the user.
Step3: Add the two matrices by using for loop.
Step4: Print Resultant matrix using print function.
Step5: Stop the program.
Program:
#include
#include
void main()
{
int m,n,o,p,i,j,k,a[20][20],b[20][20],c[20][20];
printf(Enter the row & column order first and second matrix\n);
scanf(%d%d%d%d, &m,&n,&o,&p);
printf(Enter a matrix values\n);
for(i=1;i
8/3/2019 focoldmanual
34/44
getch();
}
}
Input and Output:
Enter the row &column order first and second matrix
2
2
2
2
Enter a matrix values
43
65
76
43
Enter b matrix values23
45
67
87
The resultant matrix is
66 110
143 130
Result:
Thus the C program has been executed successfully
8/3/2019 focoldmanual
35/44
Ex. No: 8 STUDENT DETAILS
Date :
Aim:
To write a C program to use structures to print name and address of
student.
Algorithm:-
STEP-1 :- Start.
STEP-2 :- Read Structure addr,student.
STEP-3 :- Read structure members name,doorno,strtname,place,citySTEP-4 :- Print structure members name,doorno,strtname,place,city
STEP-5 :- Stop.
Program:-
#include
#include
struct addr{
int doorno[10];
char strtname[15];
char place[20];
char city[20];
};
struct student{
char name[15];
struct addr address;
}s1;
void main()
{clrscr();
printf("\n\t\t Enter Student Name: ");
gets(s1.name);
printf("\n\t Enter Address: \n");
printf("\n\t\t Enter Door number : ");
gets(s1.address.doorno);
8/3/2019 focoldmanual
36/44
printf("\n\t\t Enter Street name : ");
gets(s1.address.strtname);
printf("\n\t\t Enter Place : ");
gets(s1.address.place);
printf("\n\t\t Enter City : ");
gets(s1.address.city);
printf("\n\n\n\t\t Student Name: ");
puts(s1.name);
printf("\n\t Address: \n");
printf("\n\t\t Door number : ");
puts(s1.address.doorno);
printf("\n\t\t Street name : ");
puts(s1.address.strtname);
printf("\n\t\t Place : ");
puts(s1.address.place); printf("\n\t\t City : ");
puts(s1.address.city);
getch();
}
Input and Output:
8/3/2019 focoldmanual
37/44
Result:
Thus the C program has been executed successfully
Ex. No: 9 TABULATE THE SURVEY DATA
DATE :
Aim:
To write a C program for tabulate the survey data.
Algorithm:
Step1: Start the program.
Step2: Declare the required variable and defined the structured name as
people with Data members voter ID, age , date , month , year.
Step3: Get the input for people details using structure variable as one by
one.Step4: Print the information of people one by one using for loop.
Step5: Find the total number of males and females and print the details.
Step6: Stop the program.
Program:
#include
#include
void main()
{
int i,n,p1=0,q=0;
struct people
{
int id;
int age;
char sex;
char date;
int mm;
int yy;}
p[50];
clrscr();
printf(People surve 2009\n\n);
printf(Enter no.of people to survey\n);
scanf(%d, &n);
8/3/2019 focoldmanual
38/44
for(i=0;i
8/3/2019 focoldmanual
39/44
Input and Output:
People survey 2009
Enter no of people to survey: 2
Enter voter id number , age: 1234 22
Enter dd mm yy of dob: 12 89 30
Enter sex(M/F): M
Enter voter id number , age: 1242 21
Enter dd mm yy of dob: 10 79 02
Enter sex(M/F): f
The survey Details
Total number of persons:
2
Voter id age dob sex:
1234
22
12 89 30
1242
21
10 79 02
Total number of males :1
Total number of females:1
Result:
8/3/2019 focoldmanual
40/44
Thus the C program was successfully executed and output is verified.
Ex. No: 10
DATE :
FACTORIAL USING RECURSIVE FUNCTION
Aim:
To write a recursive function to find the factorial of a given
number.
Algorithm:
1.Declare and define the recursive function
2.Declare the required variablesin main()
3.Get the numbers to find factorial .
4.Call the factorial function from main() with the number to
find factorial as the argument
5.The factorial function calls itself again and again to calculate
factorialvalue ,until the argument value becomes 0
6.when the argument zero,it return to main() and the factorial
value is printed
Program:
#include
#include
Llong int fact(long int);
Main()
{
8/3/2019 focoldmanual
41/44
Long int num,fval;
Clrscr():
Printf(type a number :):
Scanf(%d,&num);
Fval=fact(num);
Printf(\n factorial of %d is %d ,num ,favl :);
Getch();
}
Long int fact(long int num)
{
Long int f;
If(num==0)
Return(1);
ElseF=num*fact(num-1);
Return f;
}
8/3/2019 focoldmanual
42/44
Input and Output:
Type a number :7
Factorial of 5 is 5040
Result: Thus the program to find the factorial is executed.
Result:
Thus the C program was successfully executed and output is
verified.
Ex. No: 11
DATE :
SWAPPING TWO VARIABLES USING POINTERS
8/3/2019 focoldmanual
43/44
Aim:
To write a C program for swaping the contents of two variables
using pointers as function arguments.
Algorithm:
Step1: Start the program.
Step2: Declare the required variables for swaping the variable.
Step3: Set the input from the user using scanf function.
Step4: Defined a function with arguments to pass a address of variables
to
the called Function.
Step5: Swap the two contents of variable using temp variable.
Step6: Print the contents of variable after exchange the values.
Step7: Stop the program.
Program:
#include
#include
void main()
{
int a,b;
printf(Enter the two number for exchange\n);
scanf(%d%d , &a,&b);
exchange(&a,&b);
printf(The content after exchange %d\t%d\n,a,b);
}
exchange(a,b)
int *a,*b;
{
int temp;
temp=*a;
*a=*b;
*b=temp;}
Input and Output:
8/3/2019 focoldmanual
44/44
Enter the two number for exchange
25
89
The content after exchange
89
25
Result:
Thus the C program was successfully executed and output is verified.