0% found this document useful (0 votes)
91 views176 pages

01CE1101CPLabManualv101pdf 2023 09 13 10 28 02

This document certifies that a student named Mr./Ms. _________ studying in semester ____ class ____ with enrollment number _________ has satisfactorily completed their term work in the subject of Computer Programming for the term ending in ________ year ________ as verified by the faculty in-charge and head of department.

Uploaded by

Kash Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views176 pages

01CE1101CPLabManualv101pdf 2023 09 13 10 28 02

This document certifies that a student named Mr./Ms. _________ studying in semester ____ class ____ with enrollment number _________ has satisfactorily completed their term work in the subject of Computer Programming for the term ending in ________ year ________ as verified by the faculty in-charge and head of department.

Uploaded by

Kash Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 176

This is to certify that Mr. / Ms.

________________________________________________________

studying in semester ____, class ____ of CE / IT / CE-AI having enrollment no. ___________________

has satisfactorily completed his / her term work in the subject 01CE1101 Computer Programming, for

the term ending in the month of _______________, year ___________.

Date:

Faculty In-Charge

Name:

Signature:

Head of Department:

www.marwadiuniversity.ac.in [email protected]
Rajkot-Morbi Road, Rajkot, Gujarat, India 360003
+91-281-7123456 +91-898003009
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Table of Contents
Sr. Experiment Description Page Date Marks Signature
Practical – 1
1. Motivational videos on Programming. 1
2. Introduction to Turbo C++/ code blocks/ visual 3
source code.
3. Develop a program to print “Hello World”. 5
4. Develop a program to print your address i) using 7
single printf ii) using multiple printf.
5. Develop a program to print addition of 2 9
numbers (with scanf).
Practical – 2
6. Develop a program to convert temperature 13
from Fahrenheit to Celsius. Hint: C= ((F-32)*5)/9
7. Develop a program to find percentage of 5 15
subjects.
8. Develop a program to convert seconds into 17
hours, minutes & seconds and print in
HH:MM:SS [e.g. 10000 seconds mean 2:46:40
(2 Hours, 46 Minutes, 40 Seconds)].
Practical - 3
9. Develop a program to check whetherthe given 21
number is positive or negative.
10. Develop a program to find out largest number 23
from given three numbers using Logical
Operator (&&).
11. Develop a program to check whetherthe given 25
number is positive or Negative.
12. Develop a program to find out largest number 27
from given three numbers without using
Logical Operator (&&).
Practical – 4
13. Develop a program to check whether the given 31
year is leap year or not. [If a year can be
divisible by 4 but not divisible by 100 then it is
leap year but if it is divisible by 400 then it is
leap year].
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Sr. Experiment Description Page Date Marks Signature


14. Develop a program to perform Addition, 33
Subtraction, Multiplication and Division of 2
numbers as per user’s choice.
15. Three sides of a triangle are entered through 35
the keyboard, develop a program to check
whether the triangle is isosceles, equilateral,
scalene or right-angled triangle.
Practical – 5
16. Develop a program to find out largest number 39
from given 2 numbers.
17. Develop a program to read 3 numbers, multiply 41
largest number from first two numbers to third
one.
18. Develop a program to print day name based on 43
day number.
Practical – 6
19. Develop a program to print 1 to 10. 47
20. Develop a program to find factorial of the given 49
number.
21. Develop a program to find whether the given 51
number is prime or not using break.
22. Develop a program to print digits of given 53
number.
23. Develop a program to check whether the given 55
number is palindrome or not.
24. Develop a program to check whether the given 57
number is Armstrong or not.
Practical – 7
25. Develop a program to print numbers from 1 to 61
10.
26. Develop a program to print odd numbers from 1 63
to n.
27. Develop a program to calculate the sum of first n 65
natural numbers.
28. Develop a program to display the n terms of 67
odd natural number and their sum.
29. Develop a program to find factors of the given 69
number.
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Sr. Experiment Description Page Date Marks Signature


Practical – 8
30. Develop a program to find the sum of 1 + (1+2) 73
+ (1+2+3) + (1+2+3+4) + … + (1+2+3+4+….+n).
31. Develop a program to compute the value of 75
𝑒 𝑥 by using the formula
𝑥
𝑥 𝑥2 𝑥3
𝑒 =1+ + + +⋯
1! 2! 3!

32. Develop a program to find out prime numbers 77


between given two numbers.
Practical – 9
33. Develop a program to display following 81
patterns
1 1
23 01
456 101
7 8 9 10 0101

1 *
A B * *
2 3 4 * * *
C D E F * * * *

***********
*********
*******
*****
***
*
34. Develop a program to draw Pascal's triangle. 87

Practical – 10
35. Develop a program to count number of 91
positive or negative number from an array of n
numbers.
36. Develop a program to read n numbers in an 93
array and print them in reverse order.
37. Develop a program to find Max, Min, Sum, Avg 95
of given numbers from an array.
38. Develop a program to sort elements of an array 97
in an ascending order.
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Sr. Experiment Description Page Date Marks Signature


Practical – 11
39. Develop a program to read values in two 101
dimensional array and print them in matrix
form.
40. Develop a program to count number of 103
positive, negative and zero elements from 3x3
matrix.
41. Develop a program to perform addition of two 105
matrices.
42. Develop a program to calculate the length of 107
given string using strlen.
43. Develop a program to copy string using strcpy. 109
44. Develop a program to compare two strings using 111
strcmp.
45. Develop a program to concatenate two strings 113
using strcat.
46. Develop a program to reverse string using strrev. 115

Practical – 12
47. Develop a program to count simple interest 119
using function.
48. Develop a program to generate Fibonacci 121
series of N given number using function
name fibbo. (e.g. 1 1 2 3 5 8…).
49. Develop a program to find the factorial of 123
a given number using Recursion.
Practical – 13
50. Develop a program to create structure of book 127
with book title, author name, publication, and
price. Read data of n books and display them.
51. Develop a program to access member of a 129
union using union variable.
52. Develop a program to print value and address of 131
a variable.
53. Develop a program to swap value of two 133
numbers using pointer.
Practical – 14
54. Develop a program to display content of a file. 137
55. Develop a program to copy source file to 139
destination file.
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 1
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 1
1) Motivational videos on programming.

-1-
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

-2-
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

2) Introduction to Turbo C++/ Codeblocks/ Visual Studio Code.

-3-
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

-4-
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

3) Develop a program to print “Hello World”.

-5-
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

-6-
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

4) Develop a program to print your address i) using single printf ii) using multiple
printf.

-7-
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

-8-
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

5) Develop a program to print addition of 2 numbers (with scanf).

-9-
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 10 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 11 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 12 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 2
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 2
6) Develop a program to convert temperature from Fahrenheit to Celsius.
Hint: C= ((F-32)*5)/9

- 13 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 14 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

7) Develop a program to find percentage of 5 subjects.

- 15 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 16 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

8) Develop a program to convert seconds into hours, minutes & seconds and print in
HH:MM:SS [e.g. 10000 seconds mean 2:46:40 (2 Hours, 46 Minutes, 40 Seconds)].

- 17 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 18 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 19 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 20 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 3
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 3
Using simple if
9) Develop a program to check whether the given number is positive or negative.

- 21 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 22 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

10) Develop a program to find out largest number from given three numbers using
logical operator (&&).

- 23 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 24 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Using if…else…
11) Develop a program to check whether the given number is positive or negative.

- 25 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 26 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Using nested if
12) Develop a program to find out largest number from given three numbers without
using Logical Operator (&&).

- 27 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 28 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 29 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 30 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 4
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 4
Using if…else if… else
13) Develop a program to check whether the given year is leap year or not. [If a
year can be divisible by 4 but not divisible by 100 then it is leap year but if it is
divisible by 400 then it is leap year].

- 31 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 32 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

14) Develop a program to perform Addition, Subtraction, Multiplication and Division


of 2 numbers as per user’s choice.

- 33 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 34 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

15) Three sides of a triangle are entered through the keyboard, develop a program
to check whether the triangle is isosceles, equilateral, scalene or right-angled
triangle.

- 35 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 36 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 37 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 38 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 5
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 5
Using Conditional operator (expr1?expr2:expr3)
16) Develop a program to find out largest number from given 2 numbers.

- 39 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 40 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

17) Develop a program to read 3 numbers, multiply largest number from first two
numbers to third one.

- 41 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 42 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Using Switch statement


18) Develop a program to print day name based on day number.

- 43 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 44 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 45 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 46 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 6
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 6
Discuss while loop
19) Develop a program to print 1 to 10.

- 47 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 48 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

20) Develop a program to find factorial of the given number.

- 49 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 50 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

21) Develop a program to find whether the given number is prime or not using break.

- 51 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 52 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

22) Develop a program to print digits of given number.

- 53 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 54 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

23) Develop a program to check whether the given number is palindrome or not.

- 55 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 56 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

24) Develop a program to check whether the given number is Armstrong or not.

- 57 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 58 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 59 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 60 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 7
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 7
Discuss for loop
25) Develop a program to print numbers from 1 to 10.

- 61 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 62 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

26) Develop a program to print odd numbers from 1 to n.

- 63 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 64 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

27) Develop a program to calculate the sum of first n natural numbers.

- 65 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 66 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

28) Develop a program to display the n terms of odd natural number and their sum.

- 67 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 68 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

29) Develop a program to find factors of the given number.

- 69 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 70 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 71 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 72 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 8
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 8
Discuss nested for loop
30) Develop a program to find the sum of 1 + (1+2) + (1+2+3) + (1+2+3+4) + … +
(1+2+3+..+n).

- 73 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 74 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

31) Develop a program to compute the value of 𝑒 𝑥 by using the formula


𝑥
𝑥 𝑥2 𝑥3
𝑒 =1+ + + +⋯
1! 2! 3!

- 75 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 76 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

32) Develop a program to find out prime numbers between given two numbers.

- 77 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 78 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 79 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 80 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 9
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 9
33) Develop a program to display following patterns
1 1 1 * ***********
23 01 AB ** *********
456 101 234 *** *******
7 8 9 10 0101 CDEF **** *****
***
*

- 81 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 82 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 83 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 84 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 85 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 86 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

34) Develop a program to draw Pascal's triangle.

- 87 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 88 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 89 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 90 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 10
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 10
35) Develop a program to count number of positive or negative number from an
array of n numbers.

- 91 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 92 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

36) Develop a program to read n numbers in an array and print them in reverse
order.

- 93 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 94 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

37) Develop a program to find Max, Min, Sum, Avg of given numbers from an array.

- 95 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 96 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

38) Develop a program to sort elements of an array in an ascending order.

- 97 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 98 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 99 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 100 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 11
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 11
39) Develop a program to read values in two-dimensional array and print them in
matrix form.

- 101 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 102 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

40) Develop a program to count number of positive, negative and zero elements
from 3 x 3 matrix.

- 103 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 104 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

41) Develop a program to perform addition of two matrices.

- 105 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 106 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

42) Develop a program to calculate the length of given string using strlen.

- 107 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 108 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

43) Develop a program to copy string using strcpy.

- 109 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 110 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

44) Develop a program to compare two strings using strcmp.

- 111 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 112 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

45) Develop a program to concatenate two strings using strcat.

- 113 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 114 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

46) Develop a program to reverse string using strrev.

- 115 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 116 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 117 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 118 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 12
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 12
47) Develop a program to count simple interest using function.

- 119 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 120 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

48) Develop a program to generate Fibonacci series of N given number using


function name fibbo. (e.g. 1 1 2 3 5 8…)

- 121 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 122 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

49) Develop a program to find the factorial of a given number using recursion.

- 123 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 124 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 125 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 126 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 13
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 13
Structure and Union
50) Develop a program to create structure of book with book title, author
name, publication, and price. Read data of n books and display them.

- 127 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 128 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

51) Develop a program to access members of a union using union variable.

- 129 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 130 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Pointers
52) Develop a program to print value and address of a variable.

- 131 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 132 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

53) Develop a program to swap value of two numbers using pointer.

- 133 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 134 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 135 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 136 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 14
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Practical – 14
54) Develop a program to display content of a file.

- 137 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 138 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

55) Develop a program to copy source file to destination file.

- 139 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

Output:

- 140 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 141 -
FACULTY OF TECHNOLOGY
CE / IT / CE-AI
01CE1101 – Computer Programming Lab Manual

- 142 -

You might also like