You are on page 1of 59

TABLE OF CONTENTS

PAGE
S.NO

NAME OF THE EXPERIMENT

Sign
NO.

Document Creation, Search, Generate, Manipulation


1
data using MS Office
1.a

Preparation of Advertisement

1.b

Creation of Time table

1.c

Preparation of Bio-Data

1.b

Creations of Scientific Notations

1.e

Mail Merge and Letter Preparation

Presentation and Visualization Graphs, Charts, 2D,3D

2.a

Student Mark List Using Microsoft-Excel

2.b

Electricity Bill Using Microsoft-Excel

2.c

Employee Payroll Processing Using Microsoft-Excel

2.d

Chart Line, XY, Bar And Pie.

2.e

Microsoft-PowerPoint Presentation

Problem formulation, Problem solving and Flowcharts

3.a

Drawing Flowcharts Biggest among three numbers

3.b

Drawing Flowcharts Fibonacci series

3.c

Drawing Flowcharts Sum of digits of an integer


C PROGRAMMING

Prepared BY G.RAJASEKARAN

C Programming using Simple statements and


4
expressions
Simple Menu Driven Calculator Program Using Switch
4.a
Statement
4.b

Quadratic Equation

4.c

Palindrome Number
Scientific problem using decision making and looping

5.

Prime Number

5.a

Fibonacci Series

5.b

Armstrong Number

5.c

Simple programming for one dimensional and two


6.
dimensional arrays
Largest and Smallest number in an Array

6.a

Ascending Order and Descending order

6.b

Matrix Multiplication

6.c

Reverse The Elements In An Array

6.d

Solving problems using String functions

7
7.a

String Manipulation

7.b

Alphabetical Order
Programs with user defined functions includes

8
parameter passing
8.a

Call by Value

8.b

Call by Reference

Program using recursive functions

9.a

Factorial Using Recursion

Prepared BY G.RAJASEKARAN

9.b

Fibonacci Series Using Recursion

10.

Program using structures and unions

10.a

Student Mark sheet Using Structure

10.b

Book Information using union

Prepared BY G.RAJASEKARAN

MS-WORD

Prepared BY G.RAJASEKARAN

OUTPUT :

PODHIGAI COLLEGE OF
ENGINEERING & TECHNOLOGY

Admissions
Open 2016-2017

COUNSELLING CODE
1525

UG COURSES OFFERED:
1.
2.
3.
4.

B.E - COMPUTER SCIENCE AND ENGG.


B.E - MECHANICAL ENGG
B.E - ELECTRICAL AND ELECTRONICS ENGG.
B.E - ELECTRONICS AND COMMUNICATION ENGG.

PG COURSES OFFERED:
1. M.E COMPUTER AIDED DESIGN

Prepared BY G.RAJASEKARAN

TABLE CREATION
PERIOD

II

III

IV

VI

VII

VIII

1.202.05

2.05-2.50

3.103.55

3.55-4.40

PHY

CHE

EG

CP

MAT

ENG

CHE
M

PHY

PHY

CHE

EG

CP

ENG

-------

CP

-------

9.1010.00

10.00
-10.45

11.0511.50

11.5012.35

DAY 1

EG

CP

PHY

CHE

DAY 2

CHEM

PHY

ENG

DAY 3

EG

CP

DAY 4

ENG

PHY

B MAT
R
E PHY
A
K MAT

DAY 5

EG

CP

PHY

CHE

DAY 6

PHY

CHE

MAT

ENG

DAY ORDER

S.NO

SUB.CODE

CHE
ENG

SUBJECT NAME

L
B
U
R
N
E
C
A
H
K

FACULTY NAME

B CP LAB------
R
CHE
E PHY
A
K EG LAB----------
PC LAB----------
PERIODS/
WEEK

THEORY

HS6151

Technical English-I

ENG

Ms.M.Chandra

MA6151

Engg. MathematicsI

MAT

Mr.S.Ramarao

PH6151

Engg. Physics-I

PHY

Ms.S.Kalvikarasi

CY6151

Engg. Chemistry-I

CHE

Mr.K.Arunachalam

GE6151

Computer
Programming

CP

Mr.G.Rajasekaran

GE6152

Engg. Graphics

EG

Mr.M.Narayamoorthy

1
2

5
6

PRACTICAL
7

GE6161

Computer Practices
Lab

CPL

Mr.G.Rajasekaran

GE6162

Engineering
Practices Lab

EGL

Ms.N.Barani

GE6262

Physics and
Chemistry Lab

PCL

Mr.S.Krishnamoorthy
& MR.K.Arunachalam

Prepared BY G.RAJASEKARAN

BIO-DATA
CAREER OBJECTIVE
To secure a position in a well established organization with stable environment where there is mutual
growth and constant learning.
ACADEMIC PROFILE

COURSE
B.E (CSE)
HSC
SSLC

INSTITUTION
Podhigai college of
Engineering & Technology
Govt.Boys Hr.Sec.School,
Joarpet
Govt.Boys Hr.Sec.School,
Joarpet

UNIVERSITY

YEAR

PASS
PERCENTAGE

Anna University

2016

Pursuing

State Board

2010

78.5

State Board

2008

90

TECHNICAL SKILL
Languages

: Basics of C, C++,HTML, java

Operating System

: Windows 9x/2000/XP.

DBMS

: MS-Access, SQL

Software known

: Adobe photoshop

Package

: MS-office

PERSONAL INFORMATION
Name
: M.GOKUL
Fathers Name

: Mr.S.Malaiyaan

Mothers Name

: Mrs.Jayanthi

Date of Birth

: 24.06.1999

Gender

: Male

Address

: New Street, Jolarpet

Nationality

: Indian

Language known

: Tamil,English,

DECLARATION
I hereby declare that the above mentioned details are true to the best of my knowledge.
Date:29.08.2016
Place: Tirupattur

Yours faithfully,
(M.GOKUL)

Prepared BY G.RAJASEKARAN

Scientific Notations:

(A+B) 2 = A2 +B2 +2AB


E=MC2
2Na(OH)2+Cl22NaCl+2H2O+O2

A=

+7

+6

Prepared BY G.RAJASEKARAN

Output
From
The Head of the Department
Department of CSE
Podhigai College of Engineering and Technology,
Tirupattur.
To
Mr. Rajan
HCL Corporation
Chennai
Dear Mr.Rajan,
Our Students are interested to visit your company on the first week of Next month. I
kindly request you to give permission to us.
Thanking You,
Yours faithfully,
HOD
m
The Head of the Department
Department of CSE
Podhigai College of Engineering and Technology,
Tirupattur.
To
Mr. Karthick
CTS Technologies
Chennai
Dear Mr.Karthick,
Our Students are interested to visit your company on the first week of Next month. I
kindly request you to give permission to us.
Thanking You,
Yours faithfully,
HOD

Prepared BY G.RAJASEKARAN

MS-EXCEL

10

Prepared BY G.RAJASEKARAN

Output:

Roll No

Name

Mathematics
Marks

Physics
Marks

Chemistry
Marks

Total

Average

Ajay.S

50

75

78

203

67.67

Anil Kumar.M

59

85

96

240

80.00

Babu.P

80

95

56

231

77.00

Bhoomesh.J

90

45

52

187

62.33

Boobalan.G

59

65

46

170

56.67

Dharma.R

35

88

26

149

49.67

Elavarasi.L

45

99

54

198

66.00

Ezhilarasi.C

86

65

87

238

79.33

Lakshmanan.P

87

48

56

191

63.67

10

Poorna.H

59

95

89

243

81.00

11

Poovarasan.A

54

75

56

185

61.67

12

Praveen.M

52

35

48

135

45.00

13

Ramesh.P

57

78

52

187

62.33

14

Ravi.R

65

65

58

188

62.67

15

Sanjay.T

64

62

47

173

57.67

16

Santhaseelan.D

37

49

65

151

50.33

17

Sathish.E

78

66

32

176

58.67

18

Suresh.T

76

88

78

242

80.67

19

Uma.L

94

79

95

268

89.33

20

Vani Sri.K

64

67

45

176

58.67

11

Prepared BY G.RAJASEKARAN

Output:
Consumer
Number

Name

Previous
Reading

Current
Reading

Number
of Units

Bill Amount

Ajay.S

435

520

85

120

Anil Kumar.M

300

408

108

174

Babu.P

450

660

210

490

Bhoomesh.J

230

290

60

70

Boobalan.G

356

456

100

150

Dharma.R

200

295

95

140

Elavarasi.L

257

678

421

1455

Ezhilarasi.C

345

450

105

165

Lakshmanan.P

357

634

277

758

10

Poorna.H

235

345

110

180

12

Prepared BY G.RAJASEKARAN

Output:

Employee
Number

Name

Basic
Pay

Income
Tax

Gross
Pay

DA

HRA

PF

9000

3000

Net
Pay

Deductions

800

1000

22000

1800

20200

Ajay.S

10000

Anil Kumar.M

15000 13500

4500 1200

1500

33000

2700

30300

Babu.P

20000 18000

6000 1600

2000

44000

3600

40400

Bhoomesh.J

16000 14400

4800 1280

1600

35200

2880

32320

Boobalan.G

10000

3000

800

1000

22000

1800

20200

Dharma.R

30000 27000

9000 2400

3000

66000

5400

60600

Elavarasi.L

40000 36000 12000 3200

4000

88000

7200

80800

Ezhilarasi.C

70000 63000 21000 5600

7000 154000

Lakshmanan.P

13000 11700

3900 1040

1300

28600

2340

26260

10

Poorna.H

20000 18000

6000 1600

2000

44000

3600

40400

13

9000

Prepared BY G.RAJASEKARAN

12600 141400

BAR CHART

14

Prepared BY G.RAJASEKARAN

LINE CHART

X-Y CHART

15

Prepared BY G.RAJASEKARAN

PIE CHART

16

Prepared BY G.RAJASEKARAN

MS-POWERPOINT

17

Prepared BY G.RAJASEKARAN

POWER POINT PRESENTATION


Slide 1:

Slide 2:

18

Prepared BY G.RAJASEKARAN

Slide 3:

19

Prepared BY G.RAJASEKARAN

C PROGRAMMING

20

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int num1,num2,ans1,choice;
float ans2;
clrscr();
printf(" enter two numbers");
scanf("%d%d",&num1,&num2);
printf(" enter your choice \n 1.Addition \n 2.Subtraction \n 3.Multiplication \n 4.Division
\n");
scanf("%d",& choice);
switch(choice)
{
case 1:
ans1=num1+num2;
printf("Addition =%d",ans1);
break;
case 2:
ans1=num1-num2;
printf("Subtraction =%d",ans1);
break;
case 3:
ans1=num1*num2;
printf("Multiplication =%d",ans1);
break;
case 4:
ans2=(float)num1/num2;
printf("Division =%d",ans2);
break;
default:
printf("wrong choice");
break;
}
getch();
}

21

Prepared BY G.RAJASEKARAN

Output
/*OUTPUT FOR ADDITION:
enter two number
55
66
enter your choice
1.Addition
2.Subtraction
3.Multiplication
4.Division
1
Addition=121*/
/*OUTPUT FOR SUBTRACTION:
enter two number
67
66
enter your choice
1.Addition
2.Subtraction
3.Multiplication
4.Division
2
Subtraction=1*/
/*OUTPUT FOR MULTIPLICATION:
enter two number
4
2
enter your choice
1.Addition

22

Prepared BY G.RAJASEKARAN

2.Subtraction
3.Multiplication
4.Division
3
Multiplication=8 */
/*OUTPUT FOR DIVISION:
enter two number
55
5
enter your choice
1.Addition
2.Subtraction
3.Multiplication
4.Division
4
Division =11*/
/*OUTPUT FOR WRONG CHOICE:
enter two number
55
66
enter your choice
1.Addition
2.Subtraction
3.Multiplication
4.Division
5
wrong choice

23

Prepared BY G.RAJASEKARAN

Program:
#include <stdio.h>
#include <conio.h>
#include <math.h>
main()
{
int a, b, c, d;
float r1, r2;
clrscr();
printf("Enter co-efficient for x^2 : ");
scanf("%d", &a);
printf("Enter co-efficient for x : ");
scanf("%d", &b);
printf("Enter const co-efficient : ");
scanf("%d", &c);
d = b*b - 4*a*c;
r1 = (-b + sqrt(d)) / (2.0 * a);
r2 = (-b - sqrt(d)) / (2.0 * a);
printf("Real roots are %.2f and %.2f", r1, r2);
getch();}
Output
Enter co-efficient for x^2 : 2
Enter co-efficient for x : 8
Enter const co-efficient : 6
Real roots are -1.00 and -3.00

24

Prepared BY G.RAJASEKARAN

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

25

Prepared BY G.RAJASEKARAN

Output
Sample output:
Enter a number: 131
131 is a palindrome
Sample output:
Enter a number: 123
321 is not a palindrome

26

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
void main()
{

int a,c=0,i,n; clrscr();


printf(" enter the no to be checked:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{

a=n%i;
if(a==0)
{
c=c+1;
}

}
if(c==2)
{

printf(" given no is prime"); }

else
printf(" given no is not prime");
getch();
}

Output
enter a no to be checked: 6
given no is not prime */

27

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
void main()
{ int n,first=-1,second=1,a,next;
clrscr();
printf("Enter a no:");
scanf("%d",&n);
for(a=0;a<=n;a++)
{
next= first + second;
first =second;
second = next;
printf("\n%d", next); }

getch();}

Output
Enter a no: 5
0

28

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int number,sum=0,temp,remainder;
printf("enter an integer \n");
scanf("%d",&number);
temp = number;
while(temp!=0)
{
remainder=temp%10;
sum=sum+remainder*remainder*remainder;
temp=temp/10;
}
if(number==sum)
printf("entered number is an armstrong number\n");
else
printf("entered number is not an armstrong number\n");
getch();}

Output:
Enter the number up to which Armstrong numbers are to be generated:
153
153 is a Armstrong number

29

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
include<stdio.h>
int main()
{
int number[50],size,i,big,small;
printf("\nEnter the size of the array: ");
scanf("%d",&size);
printf("\nEnter %d elements in to the array: ", size);
for(i=0;i<size;i++)
scanf("%d",&number[i]);
big= number [0];
for(i=1;i<size;i++)
{
if(big< number [i])
big= number [i];
}
printf("Largest element: %d",big);
small= number [0];
for(i=1;i<size;i++){
if(small> number [i])
small= number [i];
}
printf("Smallest element: %d",small);
return 0;
}

30

Prepared BY G.RAJASEKARAN

Output:
Sample Output:
Enter the size of the array: 4
Enter 4 elements in to the array: 2 7 8 1
Largest element: 8
Smallest element: 1

31

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int i, j, a, n, number[30];
printf("Enter the value of N \n");
scanf("%d", &n);
printf("Enter the numbers \n");
for (i = 0; i < n; ++i)
scanf("%d", &number[i]);
for (i = 0; i < n; ++i)
{
for (j = i + 1; j < n; ++j)
{
if (number[i] > number[j])
{
a = number[i];
number[i] = number[j];
number[j] = a;
}
}
}
printf("The numbers arranged in ascending order are given below \n");
for (i = 0; i < n; ++i)
printf("%d\n", number[i]);
printf("The numbers arranged in descending order are given below \n");
for (i = n; i >=0; i--)
printf("%d\n", number[i]);
getch();
}

32

Prepared BY G.RAJASEKARAN

Output
Enter the numbers
3
78
90
456
780
200
The numbers arranged in ascending order are given below
3
78
90
200
456
780
The numbers arranged in descending order are given below
780
456
200
90
78
3

33

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
void main ()
{
int a[5][5],b[5][5],c[5][5];
int row1,row2,col1,col2,i,j,k;
clrscr();
printf("Enter the row value of first matrix\n");
scanf("%d",&row1);
printf("Enter the column value of first matrix\n");
scanf("%d",&col1);
printf("Enter the row value of second matrix\n");
scanf("%d",&row2);
printf("Enter the column value of second matrix\n");
scanf("%d",&col2);
if((row1==row2)&&(col1==col2))
{
printf("Matrix can be multiply \n");
printf("Enter the values of first matrix\n");
for(i=1;i<=row1;i++)
{
for(j=1;j<=col1;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Enter the values of second matrix\n");
for(i=1;i<=row2;i++)
{

34

Prepared BY G.RAJASEKARAN

for(j=1;j<=col2;j++)
{
scanf("%d",&b[i][j]);
}
}
for(i=1;i<=row1;i++)
{
for(j=1;j<=col1;j++)
{
for(k=1;k<=col1;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
}
printf("Multiplication of the two matrix is\n");
for(i=1;i<=row1;i++)
{
for(j=1;j<=col1;j++)
{
printf("%d\t",c[i][j]);
}
printf("\n");
}
}
else
{
printf("Multiplication cannot be perform");
}
getch();
}

35

Prepared BY G.RAJASEKARAN

Output:
Enter the row value of first matrix
2
Enter the column value of first matrix
2
Enter the row value of second matrix
2
Enter the column value of second matrix
2
Matrix can be multiply
Enter the values of first matrix
22 4
3 1
Enter the values of second matrix
7 8
9 5
Multiplication of the two matrix is
154

32

27

36

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int x[10],n,i;
clrscr();
printf("enter the number of values");
scanf("%d",&n);
printf("enter the elements one by one\n");
for(i=0;i<n;i++)
scanf("%d",&x[i]);
printf("reversed array:\n");
for(i=n-1;i>=0;i--)
printf("%d\n",x[i]);
getch();
}

37

Prepared BY G.RAJASEKARAN

Output
enter the number of values 5
enter the elements one by one
3
5
1
2
6
reversed array:
6
2
1
5
3

38

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str[50],str1[50];
clrscr();
printf("Enter the string:");
gets(str);
strcpy(str1,str);
printf("Copied string is: %s",str1);
len=strlen(str);
printf("Length of the string: %d",len);
getch();
}

Output:
Enter the string: PCET
Copied string is: PCET

Enter the string: PODHIGAI


Length of the string: 8

39

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char x[50][50],temp[10][10];
int num,i,j;
clrscr();
printf("Enter the number of names:\n");
scanf("%d",&num);
printf("Enter the names one by one :\n");
for(i=0;i<num;i++)
scanf("%s",&x[i]);
for(i=0;i<num;i++)
for(j=i+1;j<num;j++)
if(strcmp(x[i],x[j])>0)
{
strcpy(temp,x[i]);
strcpy(x[i],x[j]);
strcpy(x[j],temp);}
printf("The names in alphabetical order\n");
for(i=0;i<num;i++)
printf("\n%s",x[i]);
getch();
}

40

Prepared BY G.RAJASEKARAN

OUTPUT:
ENTER THE NUMBER OF NAMES:
4
ENTER THE NAMES ONE BY ONE :
SITA
ARUN
KRISHNA
MOHAMMED
THE NAMES IN ALPHABETICAL ORDER
ARUN
KRISHNA
MOHAMMED
SITA

41

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
void interchange(int a, int b);
void main()
{
int n1=0,n2=0;
clrscr();
printf("\nSWAPPING OF TWO NUMBERS - CALL BY VALUE");
printf("\n----------------------------------------------------------");
printf("\n\nEnter the first number N1: ");
scanf("%d",&n1);
printf("\n\nEnter the second number N2: ");
scanf("%d",&n2);
printf("\n\nThe N1 and N2 values before swapping: %d %d\n",n1,n2);
interchange(n1,n2);
getch();
}
void interchange(int a, int b)
{
int temp;
temp=a;
a=b;
b=temp;
printf("\n\nThe N1 and N2 values after swapping: %d %d\n",a,b);
}

42

Prepared BY G.RAJASEKARAN

Output:
Enter the first number N1

: 15

Enter the Second number N2 : 30


The N1 and N2 values before swapping: 15 30
The N1 and N2 values after swapping : 30 15

43

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
void interchange(int *a, int *b);
void main()
{
int n1=0,n2=0;
clrscr();
printf("\nSWAPPING OF TWO NUMBERS - CALL BY VALUE");
printf("\n----------------------------------------------------------");
printf("\n\nEnter the first number N1: ");
scanf("%d",&n1);
printf("\n\nEnter the second number N2: ");
scanf("%d",&n2);
printf("\n\nThe N1 and N2 values before swapping: %d %d\n",n1,n2);
interchange(&n1,&n2);
printf("\n\nThe N1 and N2 values after swapping: %d %d\n",a,b);
getch();
}
void interchange(int *a, int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}

44

Prepared BY G.RAJASEKARAN

Output:
Enter the first number N1

: 15

Enter the Second number N2 : 30

The N1 and N2 values before swapping: 15 30


The N1 and N2 values after swapping : 30 15

45

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
int fact(int k)
{
if(k==0)
return 1;
else
return k*fact(k-1);
}
void main()
{
int n;
clrscr();
printf("\n Enter a number :");
scanf("%d",&n);
printf("\n Factorial value=%d",fact(n));
getch();
}

Output:
Enter a number: 4
Factorial value=24

46

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int n,first=-1,second=1,a,next;
clrscr();
printf("Enter a no:");
scanf("%d",&n);
for(a=0;a<=n;a++)
{
next= first + second;
first =second;
second = next;
printf("\n%d", next);
}
getch();
}

Output

Enter a no: 5
0

47

5
Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
struct student
{
char name[10][10];
int rollno,m1,m2,m3,total;
};void main()
{
int num,i,j;
struct student s1[10];
clrscr();
printf("enter the number of students");
scanf("%d",&num);
for(i=0;i<num;i++)
{
printf("Enter the roll number\n");
scanf("%d",&s1[i].rollno);
printf("Enter the name \n");
scanf("%s",&s1[i].name);
printf("Enter the mark1\n");
scanf("%d",&s1[i].m1);
printf("Enter the mark2\n");
scanf("%d",&s1[i].m2);

48

Prepared BY G.RAJASEKARAN

printf("Enter the mark3\n");


scanf("%d",&s1[i].m3);
s1[i].total=s1[i].m1+s1[i].m2+s1[i].m3;
}
printf("The details of the mark list is as follows \n");
printf("\nRollno");
printf("\tname ");
printf("\tmark1");
printf("\tmark2");
printf("\tmark3");
printf("\ttotal");
printf("\n");
for(i=0;i<num;i++)
{
printf("\n%d",s1[i].rollno);
printf("\t%s",s1[i].name);
printf("\t%d",s1[i].m1);
printf("\t%d",s1[i].m2);
printf("\t%d",s1[i].m3);
s1[i].total=s1[i].m1+s1[i].m2+s1[i].m3;
printf("\t%d",s1[i].total);
} getch(); }

49

Prepared BY G.RAJASEKARAN

Output:
enter the number of stuents2
Enter the roll number:

4561

Enter the name : lokesh


Enter the mark1 98
Enter the mark2 78
Enter the mark3 69
Enter the roll number:
Enter the name

4562

mani

Enter the mark1 88


Enter the mark2 89
Enter the mark3 98
The details of the mark list is as follows

Rollno name

mark1 mark2 mark3 total

4561

lokesh

98

78

69

245

4562

mani

88

89

98

275

50

Prepared BY G.RAJASEKARAN

Program:
#include<stdio.h>
#include<conio.h>
union book
{
int price;
char bname[20];
};
void main()
{
union book b;
printf("Enter the Book Details:\n");
printf("Enter the Book Name:\n");
scanf("%s",&b.bname);
printf("Enter the Book Price:\n");
scanf("%d",&b.price);
printf("BOOK DETAILS:\n");
printf("%s\t%d\n",b.bname,b.price);
printf("Enter the Book Name:\n");
scanf("%s",b.bname);
printf("Book Name=%s\n",b.bname);
getch();
}

Output:
Enter the Book Details:
Enter the Book Name:
English
Enter the Book Price:
150

51

Prepared BY G.RAJASEKARAN

BOOK DETAILS:
150
Enter the Book Name:
English
Book Name=English

52

Prepared BY G.RAJASEKARAN

CONTENT BEYOND THE SYLLABUS


Ex.No:11

ADDITIONAL C PROGRAMS

Program : 1
Check the Given number is Perfect or Not
#include<stdio.h>
int main(){
int n,i=1,sum=0;
printf("Enter a number: ");
scanf("%d",&n);
while(i<n){
if(n%i==0)
sum=sum+i;
i++;
}
if(sum==n)
printf("%d is a perfect number",i);
else
printf("%d is not a perfect number",i);
return 0;
}
Sample output:
Enter a number: 6
6 is a perfect number

53

Prepared BY G.RAJASEKARAN

Program :2
Check the Given number is Strong Number or Not
#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;
}
Sample output:
Enter a number: 145
145 is a strong number

54

Prepared BY G.RAJASEKARAN

Program : 3
To check given string is palindrome or not
#include<string.h>
#include<stdio.h>
int main(){
char *str,*rev;
int i,j;
printf("\nEnter a string:");
scanf("%s",str);
for(i=strlen(str)-1,j=0;i>=0;i--,j++)
rev[j]=str[i];
rev[j]='\0';
if(strcmp(rev,str))
printf("\nThe string is not a palindrome");
else
printf("\nThe string is a palindrome");
return 0;
}

Sample output:
Enter a number: madam
madam is a palindrome word

55

Prepared BY G.RAJASEKARAN

C PROGRAM TO PRINT MULTIPLICATION TABLE


#include<stdio.h>
int main(){
int r,i,j,k;
printf("Enter the number range: ");
scanf("%d",&r);
for(i=1;i<=r;i++){
for(j=1;j<=10;j++)
printf("%d*%d=%d ",i,j,i*j);
printf("\n");
}
return 0;
}
Sample Output:
Enter the number range: 5
1*1=1 1*2=2 1*3=3 1*4=4 1*5=5 1*6=6 1*7=7 1*8=8 1*9=9 1*10=10
2*1=2 2*2=4 2*3=6 2*4=8 2*5=10 2*6=12 2*7=14 2*8=16 2*9=18 2*10=20
3*1=3 3*2=6 3*3=9 3*4=12 3*5=15 3*6=18 3*7=21 3*8=24 3*9=27 3*10=30
4*1=4 4*2=8 4*3=12 4*4=16 4*5=20 4*6=24 4*7=28 4*8=32 4*9=36 4*10=40
5*1=5 5*2=10 5*3=15 5*4=20 5*5=25 5*6=30 5*7=35 5*8=40 5*9=45 5*10=50

56

Prepared BY G.RAJASEKARAN

C program to display Floyds triangle


#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;
}
Sample 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

57

Prepared BY G.RAJASEKARAN

SIMPLE C PROGRAM FOR PASCAL TRIANGLE


#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;
}

58

Prepared BY G.RAJASEKARAN

Sample output:
Enter the no. of lines: 8
1
11
121
1331
14641
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1

59

Prepared BY G.RAJASEKARAN

You might also like