You are on page 1of 77

EX.

NO : 01
DATE :

DOCUMENT GENERATION, SEARCH, TEXT MANIPULATION

AIM:
To create a document and manipulate the text with specific notations using MS-office.
HARDWARE SPECIFICATIONS:
1.
2.
3.
4.
5.
6.
7.

Mother Board
Processor
Hard Disk
Ram
Monitor
Keyboard
Mouse

: MSI
: AMD Athlon (64 bit)
: 80 GB
: 640 MB
:15inch HCL
: HCL
: HCL Optical Mouse

SOFTWARE SPECIFICATIONS:
1. MS-Office
PROCEDURE :
1. Open a new document using File New option and type text.
2. For justification, select the entire text in the document then press CTRL+J or select the
justify button

on the formatting toolbar.

3. For bold facing, select the particular word then press CTRL +B or select the

on the

formatting toolbar.
4. To make Italic style, select the particular word then press CTRL +I or select the

on

the formatting toolbar.


5. For Underlining , select the particular word then press CTRL +U or select the

on the

formatting toolbar.
6. For spelling corrections, select the particular word, then right click the mouse or click
spelling and grammar button

on the standard tool bar.

7. For saving the document, press CTRL+S or click on save button

on standard tool bar

or select the save option from the File menu.


The above options are commonly used for creating the document. Apart from these, MSWORD provides a lot of options for making the document an attractive one.

RESUME
Raghul. V
4/10,Nehru Street,
Salem-10.

e-mail id : raghul_v@yahoo.co.in
Mobile No.: 9876543210

OBJECTIVE:
To obtain a meaningful and challenging position which will enables me to become a
recognized employee, face the challenges, serve the industry with all my might and to learn and
acquire more practical knowledge.
EDUCATIONAL QUALIFICATION:
M.E. Computer Science with 8.6 CGPA in V.S.B. Engineering College,Karur.
B.E. Computer Science with an aggregate of 73% from V.S.B. Engineering College,
Karur.
HSC 2006, with an aggregate of 68% from Cheran school, Karur
SSLC 2004, with an aggregate of 72% from Cheran school, Karur
SOFTWARE SKILLS:
LANGUAGES

C, C++, JAVA.

PACKAGES

MS-Office

AREA OF INTEREST:
Data Structure
Computer Networks
PERSONAL DETAILS:
NAME

Raghul.V

FATHERS NAME

Vishnu.R

DATE OF BIRTH

06-03-1988

COMMUNICATION
ADDRESS
:

4/10,Nehru Street,
Salem-10.

DECLARATION
I hereby declare that the above details are true to the best of my knowledge.

Yours
Raghul.V

/* USE OF SCIENTIFIC NOTATIONS*/


PROCEDURE:
1. Open a new document using File New option.
2. To create Equation using Scientific Notation, choose Insert Equation.
3. Type the required equation in the Equation tool using the scientific notations found in
Equation tool Design.
4. For saving the document, press CTRL+S or click on save button
or select the save option from the File menu.
EQUATIONS:

1.
2.
3.
4.

5.

6.

=1

on standard tool bar

PARTICULARS
A
O
PERFORMANCE 05
VIVA VOCE
05
RECORD
05
TOTAL
15
A-ALLOTED, O-OBTAINED

RESULT:
Thus, the given document has been created and manipulated using MS-office.
EX.NO:02

PRESENTATION AND VISUALIZATION GRAPHS, CHARTS, 2D, 3D

DATE:
AIM:
To create slides, makes changes to slides, apply a theme, animations and transitions and
run a slide show.
HARDWARE SPECIFICATIONS:
1.
2.
3.
4.
5.
6.
7.

Mother Board
Processor
Hard Disk
Ram
Monitor
Keyboard
Mouse

: MSI
: AMD Athlon (64 bit)
: 80 GB
: 640 MB
:15inch HCL
: HCL
: HCL Optical Mouse

SOFTWARE SPECIFICATIONS:
1. MS-Office
PROCEDURE :
1. Choose the Home tab.
2. Click the New Slide button
in the Slides group. The Office Theme dialog box
appears. Click the Title and Content Layout. The slide appears on the Slides tab.
3. Click the Slides tab, located on the left side of the window.
4. Hold down the Ctrl key and then click to select the slides to which you want to apply a
theme.
5. Choose the Design tab.

6.
7.
8.
9.

Click the More button in the Themes group.


Right-click the theme you want to apply. A menu appears.
Click Apply to Selected Slides. Excel applies the theme to the slides you selected.
Choose the Animations tab.

10. Click the Custom Animation button


. The Custom Animation pane
appears.
11. Click the Add Effect button
. A menu appears.
12. Choose Entrance. A submenu appears.
13. Click Fly In. PowerPoint applies the effect. If the Auto preview box is checked,
PowerPoint automatically provides you with a preview of the animation.
14. Choose the Animations tab.
15. Click the Custom Animation button
. The Custom Animation pane
appears.
16. Click the Add Effect button
. A menu appears.
17. Choose the type of effect you want. A submenu appears.
18. Click the effect you want. PowerPoint applies the effect.
19. Click the transition you want to apply. As you roll your pointer over each transition,
PowerPoint provides you with a live preview of the transition.
20. Press F5 or Click the Slide Show icon in the bottom-right corner of your screen.
OUTPUT:

PARTICULARS

PERFORMANCE 05
VIVA VOCE
05
RECORD
05
TOTAL
15
A-ALLOTED, O-OBTAINED

RESULT:
Thus, the various slides and animation has been created successfully.

EX.NO : 03

PROBLEM FORMULATION, PROBLEM SOLVING AND FLOWCHARTS

DATE :
AIM:
To draw a flowchart using drawing toolbar in MS-WORD.
HARDWARE SPECIFICATIONS:
1.
2.
3.
4.
5.
6.
7.

Mother Board
Processor
Hard Disk
Ram
Monitor
Keyboard
Mouse

: MSI
: AMD Athlon (64 bit)
: 80 GB
: 640 MB
:15inch HCL
: HCL
: HCL Optical Mouse

SOFTWARE SPECIFICATIONS:
1. MS-Office
PROCEDURE :
1. Choose flowchart options in the auto shapes menu of the Drawing Toolbar.
2. Choose the appropriate flowchart symbol and then drag the symbol in the document.

3. Type the text in the symbol, by right click then choose Add Text.
4. Using the Arrow button, Line style button and Arrow Style in the Drawing Toolbar the
lines connecting to the different flowchart symbols.
5. Select all the flowchart symbols and lines in the document using the Select Objects
button, then right choose Grouping, then click on Group.
6. Now all the Flowchart symbols are grouped into one.

SAMPLE FLOWCHART

Start

Read a, b

Yes

No
If
a>b

Display
a

Display
b

Stop

SAMPLE PROGRAM:
1. Adding two complex numbers in C
2. C program for addition of two complex numbers
3. C program to add two complex numbers
#include<stdio.h>
#include<conio.h>
int main(){
int a,b,c,d,x,y;
clrscr();
printf("\nEnter the first complex number:");
scanf("%d%d",&a,&b);
printf("\nEnter the second complex number:");
scanf("%d%d",&c,&d);
printf("\nADDITION ");
x=a+c;
y=b+d;
if(y<0)
printf("%d-i%d",x,-y);
else
printf("%d+i%d",x,+y);
printf("\n\nSUBTRACTION ");
x=a-c;
y=b-d;
if(y<0)
printf("%d-i%d",x,-y);
else
printf("%d+i%d",x,+y);
getch();
return 0;
}

PARTICULARS
A
O
PERFORMANCE 05
VIVA VOCE
50
RECORD
05
TOTAL
15
A-ALLOTED, O-OBTAINED

RESULT:
Thus, the given flowchart has been drawn successfully.

EX. NO :4A
DATE :

SIMPLE STATEMENTS AND EXPRESSIONS- DATA TYPES

AIM:
To Write a C program to find the size of the data types.
HARDWARE SPECIFICATIONS:
1.
2.
3.
4.
5.
6.
7.

Mother Board
Processor
Hard Disk
Ram
Monitor
Keyboard
Mouse

: MSI
: AMD Athlon (64 bit)
: 80 GB
: 640 MB
:15inch HCL
: HCL
: HCL Optical Mouse

Software Specifications:
1. TURBO C
ALGORITHM:
Step-1: Start the program
Step-2: Declare the necessary variables.
Step-3: Print the size of data type for the given variable.
Step-4: Stop the program.

FLOWCHART:
Start

Enter the value of a,b,c,d

Calculate
sizeof(a);sizeof(a);sizeof(b);
sizeof(c);sizeof(c);sizeof(d)

Display size of a,b,c,d

Stop

SOURCE CODE:
#include<stdio.h>

#include<conio.h>
#include<string.h>
void main()
{
int a;
float b;
char c='U';
char d[10];
clrscr();
printf(\nENTER THE VALUE OF a,b,c\n);
printf(\n\n a=);
scanf(%d,&a);
printf(\n\n b=);
scanf(%f,&b);
printf("\nEnter character string\n");
printf(\n\nc=);
scanf("%s",d);
printf(\n\n sizeof(%d)=%d bytes,a,sizeof(a));
printf(\n\n sizeof(%f)=%d bytes,b,sizeof(b));
printf(\n\n sizeof(%c)=%d bytes,c,sizeof(c));
printf("\n\n sizeof('c')=%d bytes",sizeof('c'));
printf("\n\n sizeof(%s)=%d bytes",d,sizeof(d));
getch();
}

OUTPUT:
ENTER THE VALUE OF a, b, c
a=20
b=10
Enter character string
c=WELCOME
sizeof(10)=2 bytes
sizeof(20.000000)=4 bytes
sizeof(u)=1 bytes
sizeof(c)=2 bytes
sizeof(WELCOME)=10 bytes

EX. NO:4b
DATE :

EXPRESSION EVALUATION

AIM:
To Write a C program to evaluate the given expression r = a * (b c) / d + e.
HARDWARE SPECIFICATIONS:
1.
2.
3.
4.
5.
6.
7.

Mother Board
Processor
Hard Disk
Ram
Monitor
Keyboard
Mouse

: MSI
: AMD Athlon (64 bit)
: 80 GB
: 640 MB
:15inch HCL
: HCL
: HCL Optical Mouse

SOFTWARE SPECIFICATIONS:
1. TURBO C
ALGORITHM:
Step-1: Start the program
Step-2: Declare the necessary variables.
Step-3: Compute the given expression r = a * (b c) / d + e.
Step-4: Print the result
Step-5: Stop the program.

FLOW CHART:
Start

Enter the value of


a,b,c,d,e

Converting a,b,c,d,e in float


datatype to float of floating
point 2

Calculate
r= a * (b - c) / d + e

Display r

Stop

SOURCE CODE:
#include <stdio.h>
#include <conio.h>
void main()
{
float a,b,c,d,e,r;
clrscr();
printf("\n\n Enter the values of a,b,c,d,e\n\n");
scanf("%f %f %f %f %f",&a,&b,&c,&d,&e);
printf("\n\na = %.2f\n",a);
printf("\n\nb = %.2f\n",b);
printf("\n\nc = %.2f\n",c);
printf("\n\nd = %.2f\n",d);
printf("\n\ne = %.2f\n",e);
printf("\n\na * (b - c) / d + e\n\n");
r = a * (b - c) / d + e;
printf("\n%.2f * (%.2f - %.2f) / %.2f + %.2f = %.2f",a,b,c,d,e,r);
getch();
}

OUTPUT:
Enter the values of a,b,c,d,e
5
2
6
8
9
a = 5.00
b = 2.00
c = 6.00
d = 8.00
e = 9.00
a * (b - c) / d + e
5.00 * (2.00 - 6.00) / 8.00 + 9.00 = 6.50
EX.NO: 4C
DATE:

CONDITIONAL STATEMENT

AIM:
To write a C program to check the largest number among given three numbers.
HARDWARE SPECIFICATIONS:
1.
2.
3.
4.
5.
6.
7.

Mother Board
Processor
Hard Disk
Ram
Monitor
Keyboard
Mouse

: MSI
: AMD Athlon (64 bit)
: 80 GB
: 640 MB
:15inch HCL
: HCL
: HCL Optical Mouse

SOFTWARE SPECIFICATIONS:
1. TURBO C
ALGORITHM:
STEP-1: Start the program.

STEP-2: Declare the necessary variables.


STEP-3: CHECK IF((a > b && a > c)
STEP-3.1: Print A.
STEP-4: Otherwise, check if(b>c)
STEP-4.1: Print B
STEP-5: else print C
STEP-6: Stop.

FLOW CHART:
START

Input a, b, c

TRUE

A is great

FALSE

If a>b
&&
a>c

TRUE

B is great

If
b>c
FALSE

C is great

Stop
SOURCE CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("\nEnter any three numbers : ");
scanf("%d %d %d", &a, &b, &c );
if(a > b && a > c)
printf("\n\n %d is the largest number\n",a);
else if(b > c)
printf("\n\n %d is the largest number\n",b);
else
printf("\n\n %d is the largest number\n",c);
getch();
}
OUTPUT:
Enter any three numbers : 10 15 60
60 is the largest number
Another Method:
#include<stdio.h>
int main(){
int a,b,c,big;
printf("\nEnter 3 numbers:");
scanf("%d %d %d",&a,&b,&c);
big=(a>b&&a>c?a:b>c?b:c);
printf("\nThe biggest number is: %d",big);

return 0;
}

PARTICULARS
A
O
PERFORMANCE 05
VIVA VOCE
05
RECORD
05
TOTAL
15
A-ALLOTED, O-OBTAINED

RESULT:
Thus, the Data type, Expression Evaluation, Conditional Statements has been
executed successfully.
EX. NO : 5A
SCIENTIFIC PROBLEM SOLVING USING DECISION MAKING & LOOPING
DATE :
AIM:
To write a C program check whether a number is strong or not using decision making and
looping.
ALGORITHM:
Step1:Start the program
Step2:Declare the variables num,i,f,r,sum=0,temp.
Step3:Read the num values.
Step4:Assign temp=num values.
Step5:while(num)
5.1)Assign i=1,f=1.
5.2)r=num%10
5.3)while(i<=r)
a)f=f*i
b)i=i+1

5.4)End while
5.5)sum=sum+f
5.6)num=num/10
Step6:End while
Step7:if(sum==temp)
7.1)Print Strong Number
Step8:else Print Not Strong Number
Step9:Stop the Program.

FLOW CHART:

START

Input
num,i,f,r,temp,sum

Sum=0
Temp=sum

f
While
(num)
T
i=1,f=1
r=num%10

sum=sum+f;
num=num/10;

Not
strong
number

T
strong
number

While
(i<=r)
T
F=f*i
I++

SOURCE CODE:

if(sum
==tem
p)

Stop

#include<stdio.h>
int main(){
int num,i,f,r,sum=0,temp;
printf("Enter a number: ");
scanf("%d",&num);
temp=num;
while(num){
i=1,f=1;
r=num%10;
while(i<=r){
f=f*i;
i++;
}
sum=sum+f;
num=num/10;
}
if(sum==temp)
printf("%d is a strong number",temp);
else
printf("%d is not a strong number",temp);
return 0;
}

OUTPUT:
Enter a number: 145
145 is a strong number

EX. NO : 5B
DATE :

SCIENTIFIC PROBLEM SOLVING USING DECISION MAKING & LOOPING

AIM:
To write a C program for Pascal triangle without array and using decision making & looping.
ALGORITHM:
Step 1:Start
Step 2:Declare variables i,j,line,f=1.
Step 3:Input the line of the Pascal Triangle.
Step 4:Read the line.
Step 5:for(i=0;i<line;i++)
5.1)for(j=0;j<line-1;j++)
a)Print space
5.2)for(j=0;j<=i;j++)
a)Print values(f) using Fact(i)/fact(j)*fact(i-j) functions
b)Print space
5.3)End for.
5.4)End for.
Step 6:End for.
Step7: Function fact(num) and i=1
7.1) while(i<=num)
7.2)f=f*i and i++
7.3)End while
7.4)Return f values.
Step 8:Stop.

FLOW CHART:

Start
Read r

A
for(x=1;
x<=num; x++)
res=res*x;
return (res);

for(i=0; i<r; i+
+)
for(j=0; j<=i; j+
+)
pas=fact(i)/(fact(j)*fact(i-j));

Print pas

Stop

SOURCE CODE:
#include<stdio.h>
long fact(int);
int main(){
int line,i,j;
printf("Enter the no. of lines: ");
scanf("%d",&line);
for(i=0;i<line;i++){
for(j=0;j<line-i-1;j++)
printf(" ");
for(j=0;j<=i;j++)
printf("%ld ",fact(i)/(fact(j)*fact(i-j)));
printf("\n");
}
return 0;
}
long fact(int num){
long f=1;
int i=1;
while(i<=num){
f=f*i;
i++;
}
return f;
}

OUTPUT:
Enter the no. of lines: 5
1
11
121
1331
14641

EX. NO : 5C
DATE :

SCIENTIFIC PROBLEM SOLVING USING DECISION MAKING & LOOPING

AIM:
To write a C program for Floyds triangle using decision making & looping.
ALGORITHM:
Step 1:Start
Step 2:Declare variables i,j,k=1,range.
Step 3:Input the range of the Floids Triangle.
Step 4:Read the range.
Step 5:for(i=0;i<=range) repeat steps 5.1 to 5.4
6.1)for(j=0;j<i)
a)Print the k,%3d, 3 denotes space between two numbers.
b)Increment k by 1.
c)Increment j by 1.
6.2)End for.
6.3)Print new line.
6.4)Increment i by 1.
Step 6:End for.
Step 7:Stop.
FLOW CHART:

START
Input i,j,r

K=1
F
for(i=1;i<=r;i++)
T

for(j=1;j<=i;j++,k+
+)
T
Print K

SOURCE CODE:
#include<stdio.h>
int main(){
int i,j,r,k=1;
printf("Enter the range: ");
scanf("%d",&r);
printf("FLOYD'S TRIANGLE\n\n");
for(i=1;i<=r;i++){
for(j=1;j<=i;j++,k++)
printf(" %d",k);
printf("\n");
}
return 0;
}

Stop

OUTPUT:
Enter the range: 10
FLOYD'S TRIANGLE
1
23
456
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55

EX. NO : 5D
DATE :

SCIENTIFIC PROBLEM SOLVING USING DECISION MAKING & LOOPING

AIM:
To write a C program create a menu driven program to find Factorial, Prime or not and Even or
Odd using switch and looping.
ALGORITHM:
Step1: start the program
Step2: Read num
Step3: Enter your choice using switch function
Step4: if your choice 1. Find the factorial
Step5: set a loop up and calculate fact=fact*I and Print fact value
Step6: if your choice 2. Find Prime or Not
Step7: set a loop up to number-1 and check number is dividing by any number other than one
and itself.
Step8: if the number is divided Print Not Prime else Print Prime
Step9: if your choice 3. Find Even or Odd
Step10: if number is divided by 2 then print even number else Print Odd number.
Step11: if your choice 4. Exit the program.

Step12: stop the program.

FLOW CHART:

C
START
Read num,o,i

Case 1:
Factorial

Print
factorial

N
Y
Case 2:
Even or
Odd

Do..whil
e
N

Read Option o

Y
Case 3:
Prime or
Not

Switch(
o)

N
Y

Print Even
or Odd

Exi
t

SOURCE CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
int num,o,fact=1,i;
clrscr();
do
{
printf("1.factorial 2.Even or not 3.Prime or not 0.Exit\n");
printf("enter your Choice\n");
scanf("%d",&o);
switch(o)
{
case 1:
printf("Enter the number:\n");
scanf("%d",&num);
for(i=1;i<=num;i++)
fact=fact*i;
printf("factorial of %d! =%d\n",num,fact);
break;

Print Prime
Or Not

T
Stop

case 2:
printf("Enter the number:\n");
scanf("%d",&num);
if(num%2==0)
printf("The num is Even\n");
else
printf("The num is odd\n");
break;
case 3:
i=2;
printf("Enter the number:\n");
scanf("%d",&num);
while(i<=num-1)
{
if(num%i==0)
{
printf("The num is not prime\n");
break;
}
i++;
}
if(i==num)
printf("The num is Prime\n");
break;
case 0:
exit(0);
}
}while(1);
}

OUTPUT:
1.factorial 2.Even or not 3.Prime or not 0.Exit
enter your Choice 1
Enter the number:5
factorial of 5!=120
1.factorial 2.Even or not 3.Prime or not 0.Exit
enter your Choice 0

PARTICULARS
A
O
PERFORMANCE 05
VIVA VOCE
05
RECORD
05
TOTAL
15
A-ALLOTED, O-OBTAINED

RESULT:
Thus, the scientific problem solving using decision making and looping has been
executed successfully.

EX. NO : 6A
DATE :

ONE DIMENSIONAL ARRAY

AIM:
To write a C program to implement the one dimensional array.
ALGORITHM:
Step -1: start the program.
Step -2: declare the arrays values.
Step -3: read the array for upto n times.
Step -4: print the values.
Step -5: stop the program.

FLOW CHART:
Start

Enter three numbers

for(i=0; i<3;
i++)

read array a[i]

Print the numbers

for(i=0; i<3;
i++)

print array a[i]

stop

SOURCE CODE:
#include <stdio.h>
#include <conio.h>
void main()
{
int a[3], i;;
clrscr();
printf("\n\t Enter three numbers : ");
for(i=0; i<3; i++)
{
scanf("%d", &a[i]); // read array
}
printf("\n\n\t Numbers are : ");
for(i=0; i<3; i++)
{
printf("\t %d", a[i]); // print array
}
getch();
}

OUTPUT:
Enter three numbers : 9 4 6
Numbers are : 9

EX. NO : 6B
DATE :

TWO DIMENSIONAL ARRAY - MATRIX MULTIPLICATION

AIM:
To write a C program to implement the Matrix multiplication.
HARDWARE SPECIFICATIONS:
1.
2.
3.
4.
5.
6.
7.

Mother Board
Processor
Hard Disk
Ram
Monitor
Keyboard
Mouse

: MSI
: AMD Athlon (64 bit)
: 80 GB
: 640 MB
:15inch HCL
: HCL
: HCL Optical Mouse

SOFTWARE SPECIFICATIONS:
1. TURBO C
ALGORITHM:
Step-1: Start the program.
Step-2: Declare the necessary variables.
Step-3: Set a loop to get A matrix.
Step-4: Read A matrix value
Step-5: Set a loop to get B matrix.
Step-6: Read B matrix value.
Step-7: Assign c[i][j]=0,Using this formula to calculate the multiplication matrix
c[i][j] = c[i][j] + a[i][k] * b[k][j].
Step-8: Set a loop to print the multiplication matrix value.
Step-9: Stop the program.

FLOWCHART
Start

Declare a[i][j],b[i][j],c[i]
[j],i , j, k

Enter
A
Matrix

i=0

j=0

Read a[i]
[j]
Print \n

Yes/True
If
j<3

J++

False /No
If
i<3

Yes/True

I++

False /No
a

Enter B
Matrix
i=0

j=0

Read b[i]
[j]
Print \n

If
j<3

Yes/True

j++

False /No
If
i<3

Yes/True

False /No
Print
MATRIX
MULTIPLICATION

i++

i=0

j=0

C[i]
[j]=0

k=0

C[i][j]=c[i][j]+a[i][j]*b[i][j]

Yes/True
If
k<3

k++

False /No
If
j<3

If
i<3

Yes/True

J++

False /No
Yes/True
i++

False /No
c

i=0

j=0

Display c[i][j]

If j<3

Yes/True

i++

False /No

If i<3

Yes/True

i++

False /No
Print \n \n

SOURCE CODE:

Stop

#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3],b[3][3],c[3][3],i,j,k;
clrscr();
printf("\nENTER 'A'MATRIX\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
}
printf("\n");
}
printf("\nENTER 'B'MATRIX\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&b[i][j]);
}
printf("\n");
}
printf("__________________________\n\n");
printf("MATRIX MULTIPLICATION\n");
printf("__________________________\n\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=0;
for(k=0;k<3;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}

}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d\t",c[i][j]);
}
printf("\n\n");
}
getch();
}
OUTPUT:
ENTER 'A'MATRIX
111
222
333
ENTER 'B'MATRIX
123
123
123
__________________________
MATRIX MULTIPLICATION
__________________________
3

12

18

18

27

PARTICULARS
A
O
PERFORMANCE 05
VIVA VOCE
05
RECORD
05
TOTAL
15
A-ALLOTED, O-OBTAINED
RESULT:
Thus, the given program has been executed successfully.
Ex.No.7a

STRING FUNCTIONS-COMPARE TWO STRINGS

DATE:
AIM:
To write a C program to compare two strings using strcmp()
ALGORITHM:
Start 1: start the progrm.
Start 2: get the first string.
Start 3: get the second string.
Start 4: using strcmp () function compare the two strings.
Start 5: else prints not equal.
Start 6: stop the program.
FLOW CHART:

SOURCE CODE:
/*** Program to Compare Two Strings using strcmp() ***/
#include <stdio.h>
#include <string.h>
main()
{
char s1[20], s2[20];
int result;
printf("\nEnter first string: ");
gets(s1);
printf("\nEnter second string: ");
gets(s2);
result = strcmp(s1, s2);
if (result == 0)
printf("\nBoth strings are equal");
else
printf("\nBoth strings are not equal");

getch();
}
OUTPUT:
Enter first string: college
Enter second string: engineering
Both strings are not equal

Ex.No.7b

STRING FUNCTIONS-CONCATENATE TWO STRINGS

DATE:
AIM:
To write a C program to concatenate two strings using strcat()
ALGORITHM:
Start 1: start the progrm.
Start 2: get the first string.
Start 3: get the second string.
Satrt 4: using strcat() function to concatenate the string.
Start 5: print the concatenated string.
Start 5: stop:
FLOW CHART:

Start

Read strings
S1,S2

strcat(S1,S2)

Print the
string

Stop

SOURCE CODE:
/**** Program to Concatenate Two Strings using strcat() ****/
#include <stdio.h>
#include <string.h>
main()
{
char s1[20], s2[20];
printf("\nEnter first string: ");
gets(s1);
printf("\nEnter second string: ");
gets(s2);
strcat(s1, s2);
printf("\nThe concatenated string is: %s", s1);
getch();
}

OUTPUT:
Enter first string: Collegeof
Enter second string: Engineering
The concatenated string is: Collegeof Engineering

Ex.No.7c

STRING FUNCTIONS-COPY THE STRING

DATE:
AIM:
To write a C program to copy the strings using strcpy()
ALGORITHM:
Start 1: start the program.
Start 2: get the string.
Start 3: copy the string into another string variable by using strcpy() fucntion
Start 4: print the string.
Start 5: stop the program
FLOW CHART:

Start

Read string
S1
Strcpy
(S2,S1)
Print The
string S2
Stop
strcpy(S2,S1)
Read string S1

Print the string


S2

Stop
SOURCE CODE:
/*** Program to Copy String using strcpy() ***/
#include <stdio.h>
#include <string.h>
main()
{
char s1[20], s2[20];
printf("\nEnter string into s1: ");
gets(s1);
strcpy(s2, s1);
printf("\ns2: %s", s2);
getch();
}

OUTPUT:
Enter string into s1: Engineering
s2: Engineering

Ex.No.7d STRING CONVERTION TO LOWER CASE,UPPERCASE, STRING LENGTH


DATE:
AIM:
To write a C program to convert the strings to lower case, upper case, find string length.
ALGORITHM:
Start 1: start the program.
Start 2: get the string.
Start 3: using strlwr() fucntion to convert the lower case of the string.
Start 4: print the lower string.
Start 5: using strupr() fucntion to convert theupper case of the string.
Start 6: print the upper string.
Start 7: using strrev() fucntion to convert the reverse order of the string.

Start 8: using strlen() function to find the length of the string.


Strat 9: print the string.
Start 10: stop the program.
FLOW CHART:
Start

Read the
string

S1=strlwr(s)
S2=strupr(s)
S3=strrev(s)
N=strlen(s)

Print S1,S2,S3,N

Stop
SOURCE CODE:
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
char str[50];
clrscr();
printf("\n\t Enter your name : ");
gets(str);
printf("\nLower case of string: %s",strlwr(str));
printf("\nUpper case of string: %s",strupr(str));
printf("\nReverse of string: %s",strrev(str));
printf("\nLength of String: %d",strlen(str));
getch();

OUTPUT:
Enter your name : Colllege
Lower case of string: colllege
Upper case of string: COLLLEGE
Reverse of string: EGELLLOC
Length of String: 8

PARTICULARS
A
O
PERFORMANCE 05
VIVA VOCE
05
RECORD
05
TOTAL
15
A-ALLOTED, O-OBTAINED

RESULT:
Thus, the given program has been executed successfully.
Ex.No.8

USER DEFINED FUNCTIONS-SWAPPING OF TWO NUMBERS

DATE:
AIM:
To write a C program to swap two numbers using pointers.
ALGORITHM:
1. Declare the two pointer variables.
2. Get the value for both the variables.

3. Swap the values.


4. Print the result.
FLOW CHART:

Start

Initialize the function

Read a, b

Print values a, b before


swapping

Calling Start
Initialize the function
Read a,b
Print values a, b before
swapping
Definea,swap
Print values
b after swapping
Calling swap
Print values a, b after
swapping
swap
SOURCE CODE:

Stop

#include<stdio.h>
#include<conio.h>
void swap(int *,int *);
void swap1(int,int);
void main()
{
int a,b,c,d;
clrscr();
printf("Enter the values of a and b:=

");

Define swap

scanf("%d %d",&a,&b);
printf("Enter the values of c and d:= ");
scanf("%d %d",&c,&d);
printf("\n BEFORE SWAPPING : ");
printf("\n The value of a and b is : %d\t %d ",a,b);
printf("\n The value of c and d is : %d\t %d ",c,d);
printf("\n AFTER SWAPPING : ");
swap(a,b);
swap1(&c,&d);
printf("\n Method is:-Call by Value");
printf("\n **************************");
printf("\n The value of a and b is : %d\t %d",a,b);
printf("\n Method is:-Call by Address or Reference");
printf("\n ***************************");
printf("\n The value of c and d is : %d\t %d",c,d);
getch();
}
void swap(int *c,int *d)
{
int t;
t=*c;
*c=*d;
*d=t;
}
void swap1(int a,int b)
{
int t;
t=a;
a=b;
b=a;
}

OUTPUT:
Enter the values of a and b: =
Enter the values of c and d: =
BEFORE SWAPPING:
The value of a and b is: 2
The value of c and d is: 6

2
6

4
5
4
5

AFTER SWAPPING:
Method is:-Call by Value
The value of a and b is: 2
4
Method is:-Call by Address or Reference
The value of c and d is: 5

PARTICULARS
A
O
PERFORMANCE 05
VIVA VOCE
05
RECORD
05
TOTAL
15
A-ALLOTED, O-OBTAINED

RESULT:
Thus, the given program has been executed successfully.
EX.NO:9A
DATE:

RECURSIVE FUNCTIONS -FIBONACCI SERIES

AIM:
To write a program in C

i) To print the Fibonacci series


ALGORITHM:
Step-1:Start
Step-2:Read the input variable n
Step-3:Call function fib(n)
Step-4:Stop.
FUNCTION:
Step-1:a=0,b=1
Step-2:print a, b
Step-3:for(i=0;i<n;i++)
Step-3-1:c=a+b
Step-3-2:a=b
Step-3-3:b=a
Step-3-4:prin c
Step-4:stop

FLOW CHART:
START

Enter Fibonacci Limit,


n

Initialize a=0,b=1

print a,b

Initialize i=0

NO/FALSE

If i<n
YES/TRUE

STOP

calculate
c=a+b;
a=b;
b=c;
i++
print c

SOURCE CODE:
#include<stdio.h>
void printFibonacci(int);
int main(){
int k,n;

long int i=0,j=1,f;


printf("Enter the range of the Fibonacci series: ");
scanf("%d",&n);
printf("Fibonacci Series: ");
printf("%d %d ",0,1);
printFibonacci(n);
return 0;
}
void printFibonacci(int n){
static long int first=0,second=1,sum;
if(n>0){
sum = first + second;
first = second;
second = sum;
printf("%ld ",sum);
printFibonacci(n-1);
}
}

OUTPUT:
Enter the range of the Fibonacci series: 10
Fibonacci Series: 0 1 1 2 3 5 8 13 21 34 55 89

EX.NO:9B
DATE:

RECURSIVE FUNCTIONS FACTORIAL OF A NUMBER

AI M:
To write a C program to find the factorial of a given number.
ALGORI THM
1. Start the program.
2. Declare the necessary variables.
3. Get the number from user to find the factorial.
4. Write a user defined function for factorial using the formula n*fact (n-1).
5. Print the factorial of the given number.
6. Stop the program.
FLOW CHART:

SOURECE CODE:
#include<stdio.h>
#include<conio.h>

void main()
{
int fact(int);
int n,f,choice;
clrscr();
printf(Enter the number to find the factorial\n);
scanf(%d,&n);
f=fact(n);
printf(The factorial of a number %d using recursion is %d,n,f);
getch();
}
int fact(int n)
{
int f;
if(n==0)
return(1);
else
f=n*fact(n-1);
return(f);
}

OUTPUT
Enter the number to find the factorial
5
The factorial of a number 5 using recursion is 120

Additional Programs:
1. C program to check if a number is palindrome using recursion

#include<stdio.h>
int checkPalindrome(int);
int main(){
int num,sum;
printf("Enter a number: ");
scanf("%d",&num);
sum = checkPalindrome(num);
if(num==sum)
printf("%d is a palindrome",num);
else
printf("%d is not a palindrome",num);
return 0;
}
int checkPalindrome(int num){
static int sum=0,r;
if(num!=0){
r=num%10;
sum=sum*10+r;
checkPalindrome(num/10);
}
return sum;
}
Sample output:
Enter a number: 25
25 is not a palindrome
2. C program to reverse a number using recursion
#include<stdio.h>
int main(){
int num,reverse;
printf("Enter any number: ");
scanf("%d",&num);
reverse=rev(num);
printf("Reverse of number: %d",reverse);
return 0;
}
int rev(int num){
static sum,r;
if(num){
r=num%10;

sum=sum*10+r;
rev(num/10);
}
else
return 0;
return sum;
}
Sample output:
Enter any number: 456
Reverse of number: 654

PARTICULARS
A
O
PERFORMANCE 05
VIVA VOCE
05
RECORD
05
TOTAL
15
A-ALLOTED, O-OBTAINED

RESULT:

Thus, the given program has been executed successfully.


EX.NO:10A
DATE:

PROGRAM FOR STRUCTURE

AIM:
To prepare the mark sheet of n students using structures and to write a C program using
Structure.
HARDWARE SPECIFICATIONS:
1.
2.
3.
4.
5.
6.
7.

Mother Board
Processor
Hard Disk
Ram
Monitor
Keyboard
Mouse

: MSI
: AMD Athlon (64 bit)
: 80 GB
: 640 MB
:15inch HCL
: HCL
: HCL Optical Mouse

SOFTWARE SPECIFICATIONS:
1. TURBO C
ALGORITHM:
STEP-1: Start the program.
STEP-2: Defining the structure student with members.
STEP-3: Declare the necessary variables.
STEP-4: Set a loop to get the details of student mark list
STEP-5: Read the student details.
STEP-6: Total the marks, and to calculate the average of students mark.
STEP-7: Check the conditions.
STEP-8: Set a loop to print the mark list
STEP-9: Stop.
FLOWCHART:
Start

Initialize i, n
ENTER THE
VEALUE OF n

STUDENT
Read Print
Name,
R.No,
DETAILS
i=0
i<n
m1,m2,m3

I++

Read n
a

a
ENTER NAME, RNO
AND MARKS
i=0

Read Name, R.No,


m1,m2,m3
YES/TRUE

If
i<n

i++

NO/FALSE

Print STUDENT
DETAILS

i=0

c[i].tot=c[i].m1+c[i].m2+c[i].m3+c[i].m4;
c[i].avg=(c[i].tot)/4;

Print Name, R.No,


m1,m2,m3, tot, avg

YES/TRUE

If
i<n

i++

NO/FALSE
SOURCE CODE:
#include<stdio.h>
Stop
#include<conio.h>
struct student
{
char name[20];
int rno;
}s;
struct cse
{
int m1;
int m2;
int m3;
int m4;
int tot;
float avg;
struct student s;
}c[10];
void main()
{
int i,n;
clrscr();
printf("ENTER THE VEALUE OF n\n\n");
scanf("%d",&n);
printf("\nENTER NAME,RNO AND MARKS \n\n");
for(i=0;i<n;i++)
{
scanf("%s%d",c[i].s.name, &c[i].s.rno);
scanf("%d",&c[i].m1);
scanf("%d",&c[i].m2);
scanf("%d",&c[i].m3);
scanf("%d",&c[i].m4);
}
printf("\n\n\n");
printf("\t\t******************STUDENT DETAILS***************\n");
printf("\t------------------------------------------------------------------\n");
printf("\tNAME\tRNO\tM1\tM2\tM3\tM4\tTOTAL\tAVERAGE\n");
printf("\t------------------------------------------------------------------\n");
for(i=0;i<n;i++)
{
c[i].tot=c[i].m1+c[i].m2+c[i].m3+c[i].m4;
c[i].avg=(c[i].tot)/4;

printf("\t%s\t%d\t%d\t%d\t%d\t%d\t%d\t%.2f\n\n",c[i].s.name,c[i].s.rno,c[i].m1,
c[i].m2,c[i].m3,c[i].m4,c[i].tot,c[i].avg);
}
printf("\t------------------------------------------------------------------\n");
getch(); }
OUTPUT:
ENTER THE VEALUE OF n
2
ENTER NAME,RNO AND MARKS
Sugir
23
95
85
85
95
Jai
12
98
98
78
98
***********************STUDENT DETAILS******************
--------------------------------------------------------------------------------------NAME
RNO M1
M2
M3
M4 TOTAL AVERAGE
---------------------------------------------------------------------------------------Sugi
23
95
85
85
95
360
90.00
Jai

12

98

98

78

98

372

93.00

EX.NO:10B
DATE:

PROGRAM FOR UNION

AIM:
To prepare the mark sheet of n students using structures and to write a C program using
Union.
ALGORITHM:
STEP-1: Start the program.
STEP-2: Defining the Union student with members.
STEP-3: Declare the necessary variables
STEP-5: Read the values declared for the variables.
STEP-6: Using reference the value is declared to the variables.
STEP-7: Display the values.
Step-8 : Print the result.
Step-9 : Stop.
FLOWCHART:

Start

Int a; Char b[2];

c.a=256

Print c.a

Print c.b[0]

Print c.b[1]

Stop
SOURCE CODE:
#include<stdio.h>
#include<conio.h>
union student
{
int a;
char b[2];
}c;
void main()
{
c.a=256;
printf(\n Values Of c.a is = %d ,c.a);
print(\n Values Of c.b[0]=%d,c.b[0]);
printf(\n Values Of c.b[1]=%d,c.b[1]);
getch();
}

OUTPUT:
Value of c.a is = 256
Value of c.b[0] = 0
Value of c.b[1] = 1

PARTICULARS
PERFORMANCE
VIVA VOCE
RECORD
TOTAL

A
05
05
05
15

A-ALLOTED, O-OBTAINED

RESULT:
Thus, the given program has been executed successfully.

You might also like