Ge6161 Computer Practices Lab PDF
Ge6161 Computer Practices Lab PDF
LAB MANUAL
Regulation : 2013
Branch : B.E. – All Branches
Year & Semester : I Year / I Semester
GE6161
GE6161 – COMPUTER PRACTICES
PRACTICES LAB
REGULATION - 2013
LIST OF EXPERIMENTS:
1. Search, generate, and manipulate data using MS office / Open Office
9. Program using Recursive Function and conversion from given program to flow chart.
TOTAL PERIODS: 45
INDEX
SIGNATURE OF THE
S.NO DATE TITLE REMARKS
STAFF
MICROSOFT WORD
1 Creating Advertisement
2 Curriculum Vitae
3 Scientific Notations
Creating Timetable and
4
Conversion
Mail merge and Letter
5
preparation
6 Drawing flowchart
MICROSOFT EXCEL
INDEX
SIGNATURE
S.NO DATE TITLE OF THE REMARKS
STAFF
C PROGRAMS
13 Factorial of a number
14 Fibonacci Series
Sum of the digits, Reverse and
15
Palindrome
16 Pascal’s Triangle
17 Matrix Multiplication
18 String Concatenation
19 String Comparison
20 String Copy
21 String Length
INTRODUCTION
Basic Concepts of C :
C was originally developed by Dennis Ritchie between 1969 and 1973 at Bell
Labs, and used to re-implement the Unix operating system. It is the most widely used
programming languages of all time. C has been standardized by the American National
Standards Institute (ANSI) since 1989 and subsequently by the International Organization
for Standardization (ISO).
Uses of C language:
Database Systems
Language Interpreters
Compilers and Assemblers
Operating Systems
Network Drivers
Word Processors
Features of C language:
• C is robust language with rich set of built-in functions and operators
• Programs written in C are efficient and fast.
• C is highly portable.
• C is basically a collection of C library functions.
• C is easily extensible.
C Data Types:
Character Array
Integer Pointer
Float Structure
Double Union
Void Enum
(i) if statement
(ii) if else statement
(iii)else if statement
(iv) switch statement
C supports following types of loops:
C function is a self contained block of statements that can be executed repeatedly whenever
we need it.
Provides modularity.
C Arrays:
An array is a data structure in C, that can store a fixed size sequential collection of
elements of same data type. There are three types of arrays:
One-dimensional array
Two-dimensional array
Multi-dimensional array
C Strings:
In C, the one-dimensional array of characters are called strings, which is terminated
by a null character ‘\0’.
Ex. No : 1
Date :
CREATING ADVERTISEMENT
AIM:
ALGORITHM:
OUTPUT:
RESULT:
Thus the advertisement has been created with some specifications in Microsoft
word successfully and verified.
Ex. No: 2
Date:
CURRICULUM VITAE
AIM:
ALGORITHM:
OUTPUT:
RESULT:
Thus the curriculum vitae (CV) has been created with some specifications in
Microsoft word successfully and verified.
Ex. No: 3
Date:
SCIENTIFIC NOTATIONS
AIM:
i. A= + + +
ii. +
iii.
iv.
v. +7 4 +6 o
ALGORITHM:
OUTPUT:
RESULT:
Thus the scientific notations has been created in Microsoft word successfully and
verified.
Ex. No: 4
Date :
To prepare a class timetable using Merge rows, Split row, Insert rows, columns
and convert the table into text format.
ALGORITHM:
Select one row Right click InsertInsert One row above or below
Select one column Right click InsertInsert One column left or right
OUTPUT:
RESULT
Thus the class time table has been created & table is converted into text in
Microsoft word successfully and verified.
Ex. No: 5
Date :
AIM:
To create a WORD document to call letters for an interview using Mail Merge send
to10 candidates
ALGORITHM:
Step 3: Type a interview call letter with FROM address and leave some
Columns Ok
Step 6: Goto Select recipients Use Existing list open a file ->Ok
Step 7: Under the TO Address insert the Merge fields & preview the results
OUTPUT:
RESULT:
Thus the Mail Merge has been created in Microsoft word successfully and
Verified.
Ex. No: 6
Date :
ALGORITHM:
Step 3: Insert the Correct shapes for Input box, decision box, Calculation box
RESULT:
Thus the flowchart has been drawn using Ms-word successfully and verified.
Ex. No: 7
Date :
SPREAD SHEET CHART (Line,XY,Bar and Pie)
AIM:
To create a EXCEL to analyze the marks of the students of a class using various
ALGORITHM:
Step 2: Place the Cursor on the desired cell and start entering the required
Student details
Step 3: To find the Total and Average using formula (Total = m1+m2+m3)
Average = (Total / 3)
Step 4: Select the table and goto Insert Chart Choose one type of
Chart
Step 5: Reselect the table again and Insert Chart Choose another
OUTPUT:
RESULT:
Thus the Spreadsheet charts (Line,XY,Bar and Pie) for students marks has
been created Successfully and verified.
Ex. No: 8
Date :
SPREAD SHEET FORMULA EDITOR
AIM:
To create a spreadsheet to calculate HRA , DA, TA, PF, LIC. Gross Salary , Net
Salary from the below given data
Gross Salary = Basic Pay + HRA + DA + TA Net Salary = Gross Salary – Deduction
ALGORITHM:
Step 2. Type the details about the employees and Basic Salary.
Step 3. For HRA & DA, move to corresponding row & column and assign the
& column and assign the formula =15/100* BS (row & column)
. Step 4. For TA & PF, move to corresponding row & column and assign the formula
=12/100* BS (row & column) For PF ,move to corresponding row & column
Step 5. For LIC & GS, move to corresponding row & column and assign the formula
=7/100* BS,For GS ,move to corresponding row & column and assign the
formula = Basic Pay + HRA + DA + TA
Step 6. Likewise for Deduction and Net Salary
Step 7. Save the ExcelSheet
Step 8. Stop the program
OUTPUT
RESULT:
Thus the Spreadsheet to calculate HRA , DA, TA, PF, LIC. Gross Salary , Net Salary
from the given data has been created Successfully and verified.
Ex. No : 9
Date :
AREA AND CIRCUMFERENCE OF THE CIRCLE
AIM:
To write a C program to find the area and circumference of the circle
ALGORITHM:
Step 1: Start the program.
Step 2: Input the radius of the Circle.
Step 3: Find the area and circumference of the circle using the formula
Area =3.14*r*r
Circum=2*3.14*r
#include<stdio.h>
#include<conio.h>
void main()
{
float r,area,circum;
clrscr();
printf("\n Enter the radius of the Circle");
scanf("%f",&r);
area=3.14*r*r;
circum=2*3.14*r;
printf("\n Area=%f",area);
printf("\n Circumference=%f",circum);
getch();
}
RESULT:
Thus the C program to find the area and circumference of the circle has been created
successfully and verified.
Ex. No : 10
Date :
TERNARY OPERATOR
AIM:
To write a C program to check the largest number among given two numbers.
ALGORITHM:
#include<stdio.h>
#include<conio.h>
void main( )
{
int a,b,big; clrscr( );
printf("Enter the value of a: ");
scanf("%d",&a);
printf("Enter the value of b");
scanf(“%d”,&b);
big=(a>b)?a:b;
printf("Biggest of the given numbers is %d",big);
getch();
}
RESULT:
Thus the program for Conditional Statements has been executed successfully and the
output was verified.
Ex. No : 11
Date :
ALGORITHM:
Step 1: Start
Step 7: Stop
#include <stdio.h>
#include <math.h>
#include <conio.h>
void main()
{
float a, b, c, d, r1,r2, real, imag; clrscr();
printf("\nTO FIND THE ROOTS OF A QUADRATIC EQUATION");
printf("\nEnter the coefficients a, b and c: ");
scanf("%f%f%f",&a,&b,&c);
d=b*b-4*a*c;
if (d>0)
{
r1= (-b+sqrt(d))/(2*a);
r2= (-b-sqrt(d))/(2*a);
printf("Roots are: %.2f and %.2f.They are real and
distinct.", r1 , r2);
}
else if (d==0)
{
r1 = r2 = -b/(2*a);
printf("Roots are: %.2f and %.2f. They are real and
equal.", r1, r2);
}
else
{ real= -b/(2*a);
imag = sqrt(-d)/(2*a);
printf("Roots are: %.2f+%.2fi and %.2f-%.2fi. They
are complex.", real, imag, real, imag);
}
getch();
}
RESULT:
Thus the C program for finding roots of quadratic equation was executed and output
was obtained.
Ex. No: 12
Date :
ARMSTRONG NUMBER
AIM:
To write a C Program to check whether the given number is Armstrong or not.
ALGORITHM:
Step 1: Start the program
Step2: Read the variable N
Step 3: Assign N1=N;
Step 4: Create Set a loop using the condition WHILE(N1!=0), if the condition true
REM=N1%10;
NUM=NUM+REM*REM*REM;
N1=N1/10;
Step 5: Else, check the condition IF(NUM=N), if the condition true
Step6: PRINT “Armstrong Number”
Step 7: Else PRINT “Not Armstrong Number”
Step 8: Stop the program
num=num+(rem*rem*rem);
n1=n1/10;
}
if(num==n)
printf("%d is an Armstrong number",n);
else
printf("%d is not an Armstrong number",n);
getch();
}
OUTPUT:
RESULT
Thus the C program to check whether the given number is Armstrong or not was
executed and the output was obtained.
Ex. No: 13
Date :
FACTORIAL OF A NUMBER
AIM:
To write a program to calculate the factorial of the given number using functions.
ALGORITHM:
Step 1: Start the program
Step2: Enter a number.
Step 3: Set a loop to find the factorial of the given no using Fact=fact*i
Step 4: Print the factorial of the given number.
Step 5: Stop the program
#include<stdio.h>
void main()
{
int fact=1,i,num;
printf("Enter the number");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
fact=fact*i;
}
printf("the factorial of %dis %d",num,fact);
getch();
}
RESULT:
Thus the C program to calculate factorial of the given number using function is
Ex. No: 14
Date :
FIBONACCI SERIES
AIM:
To write a C program to find the Fibonacci series of the given number.
ALGORITHM:
Step 1. Start the program
Step 2. Enter the number.
Step 3. Check the number whether the number is zero or not.
If zero print zero value.If not zero go further.
Step 4. Set a loop upto the given number.
Step 5. Assign fib=fib+a; a=b; b=c;
Step 6. Every increment in the loop prints the value of fib.
Step 7. After the execution of the loop, stop the program.
#include<stdio.h>
#include<conio.h>
Void main()
{
int num,fib=0,a=0,b=1,i;
clrscr();
printf("Enter the number");
scanf("%d",&num);
printf("FIBBONACI SERIES\n");
if(num==0)
printf("0");
else
{
for(i=0;i<num;i++)
{
fib=fib+a;
a=b;b=fib;
printf("%d\t",fib);
getch();
}
}
}
RESULT:
Thus the C program to find Fibonacci series of the given number was executed and
verified successfully.
Ex. No: 15
Date :
SUM OF DIGITS, REVERSE, PALINDROME
AIM:
To write a C program to find the sum & reverse of digits and Check is Palindrome or
not
ALGORITHM:
Step 1. Start the program
Step 2. Enter the number.
Step 3. Set a loop upto the number is not equal to zero .
Remnum%10 SumSum+rem Rnum rnum *10 +rem Num num/10
Step 4. After the end of the loop print the sum and reverse no of the digit.
Step 5. Find whether the reverse no is equal to the input number. If equal, then it is
Palindrome.
RESULT
Thus the C program to find the sum & reverse of digits and to check whether it is
Palindrome or not was executed and verified successfully.
Ex. No: 16
Date :
PASCAL’S TRIANGLE
AIM:
To write a C program to print Pascal’s triangle.
ALGORITHM:
Step 1: Start the program
Step 2: Read input n.
Step 3: Create the first loop to print n lines.
Step 4: Check l<= n
Step 5: Create the second loop to generate 40 spaces initially, then reduce
by 40-3*l equation.
Step 6: Check i>0
Step 7: Create the third loop to generate and print digits.
Step 8: Use m=m*(l-j+1)/j to print digits in each line .
Step 9: Stop the execution.
PROGRAM: (PASCAL’S TRIANGLE)
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,l,m,n;
clrscr();
printf("How many rows?\n");
scanf("%d",&n);
printf("\n\t\t\t\t Pascal’s Triangle\n");
m=1;
for(l=0;l<n;l++)
{
for(i=40-3*l;i>0;i--)
printf(" ");
for(j=0;j<=l;j++)
{
if((j==0)||(l==0))
m=1;
else
m=(m*(l-j+1))/j;
printf("%6d",m);
}
printf("\n");
}
getch();
}
OUTPUT:
RESULT
Thus the C program has been written to print the Pascal’s triangle and the output was
verified.
Ex. No: 17
Date :
MATRIX MULTIPLICATION
AIM:
To write a C program to perform Matrix Multiplication using array.
ALGORITHM:
Step 1: Start the program
Step 2: Declare variables
Step 3: Get the rows and columns of two matrices M, N, O, P respectively.
Step 4: Check N is not equal to O, if go to step 10.
Step 5: Set a loop and get the elements of first matrix A[i][i].
Step 6: Set a loop and get the elements of second matrix B[i][j].
Step 7: Repeat the step 6 until i<m, j<p and k<n.
Step 8: Initialize C[i][j]=0 and multiply the two matrices and store the resultant in
C[i][j]= C[i][j]+A[i][k]*B[k][j].
Step 9: Print the resultant matrix C[i][j] and go to step 11.
Step 10: Print the message “Column of first matrix must be same as row of second
matrix”.
Step 11: Stop the program.
#include<stdio.h>
#include<conio.h>
#include<stdio.h>
void main()
{
int a[10][10],b[10][10],c[10][10],i,j,k,m,n,o,p;
clrscr();
printf("\nMATRIX MULTIPLICATION\n");
printf("\n-------------------------------\n");
printf("\nEnter the rows & columns of first matrix: ");
scanf("%d %d",&m,&n);
printf("\nEnter the rows & columns of second matrix: ");
scanf("%d %d",&o,&p);
if(n!=o)
{
printf("Matrix mutiplication is not possible");
printf("\nColumn of first matrix must be same as row
of second matrix");
}
else
{
printf("\nEnter the First matrix-->");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("\nEnter the Second matrix-->");
for(i=0;i<o;i++)
{
for(j=0;j<p;j++)
{
scanf("%d",&b[i][j]);
}
}
printf("\n\nThe First matrix is\n"); for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<n;j++)
{
printf("%d\t",a[i][j]);
}
}
printf("\n\nThe Second matrix is\n");
for(i=0;i<o;i++)
{
printf("\n");
for(j=0;j<p;j++)
{
printf("%d\t",b[i][j]);
}
}
for(i=0;i<m;i++) //row of first matrix
{
for(j=0;j<p;j++) //column of second matrix
{
c[i][j]=0;
for(k=0;k<n;k++)
{
c[i][j]= c[i][j]+a[i][k]*b[k][j];
}
}
}
}
printf("\n\nThe multiplication of two matrix is\n");
for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<p;j++)
{
printf("%d\t",c[i][j]);
}
}
getch();
}
OUTPUT:
RESULT
Thus the C program to perform Matrix Multiplication was executed successfully and
the output was verified.
Ex. No: 18
Date :
STRING CONCATENATION
AIM:
To write a program to perform the string Concatenation using C.
ALGORITHM:
Step 1: Start the program
Step 2: Declare the variables.
Step 5: Store the concatenated string into str[k]. Print the String
Step 6: Stop the program
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
char str[10],str1[10],str2[20];
clrscr();
printf("\n Enter the String1:");
gets(str1);
printf("\n Enter the String2:");
gets(str2);
for(i=0,j=0;str1[i]!='\0';i++,j++)
str[j]=str1[i];
for(i=0,k=j;str2[i]!='\0';i++,k++)
str[k]=str2[i];
str[k]='\0';
printf("\n The Concatenated String is %s",str);
getch();
}
OUTPUT:
RESULT
Thus the C program to perform String Concatenation is created successfully and the
output was verified.
Ex. No: 19
Date :
STRING COMPARISON
AIM:
To write a program to perform the string Comparison using C.
ALGORITHM:
OUTPUT:
RESULT
Thus the C program to perform String Comparison is created successfully and the
output was verified.
Ex. No: 20
Date :
STRING COPY
AIM:
To write a program to perform the string copy using C.
ALGORITHM:
OUTPUT:
RESULT
Thus the C program to perform String Copy is created successfully and the output was
verified.
Ex. No: 21
Date :
STRING LENGTH
AIM:
To write a program to find the length of the string using C.
ALGORITHM:
OUTPUT:
RESULT
Thus the C program to find length of the string was created successfully and the
output was verified.
Ex. No: 22
Date :
PAYROLL PROCESSING USING UNION
AIM:
To write a C Program to create payroll processing using union.
ALGORITHM:
OUTPUT:
RESULT
Thus a C program to implement the payroll processing using union was executed and
the output was obtained
Ex. No: 23
Date :
EMPLOYEE DETAILS USING STRUCTURE
AIM:
To write a C program to print the employee details of employees using structure.
ALGORITHM:
OUTPUT:
RESULT
Thus the program to print the employee details using structure is created successfully
and the output was verified.
Ex. No: 24
Date :
AIM:
To write a C program to swap two numbers using pointers.
ALGORITHM:
OUTPUT:
RESULT
Thus, the given program has been executed successfully and the output was verified.