C Programming Record Book
C Programming Record Book
23ADL001- C PROGRAMMING
Name :-------------------------------------
Roll No.:-------------------------------------
Year/Semester:----------------------------
Dept. :-------------------------------------
Dr. Mahalingam College of Engineering and Technology,
Pollachi-642 003.
23ADL001- C PROGRAMMING
NAME :
ROLLNO. :
CLASS :
Certifiedthatthisisbonafiderecordofworkdonebytheabovestudentofthe
Examiner1 Examiner2
23ADL001- C PROGRAMMING
OF FACULTY
1 23ADL001-C PROGRAMMING
Flow Chart:
Start
Get A&B
Compute a+b,a-
b,a*b,a/b
Display
Results
Stop
2 23ADL001-C PROGRAMMING
1. Implement basic C programs using data types
Aim:
Algorithm:
3 23ADL001-C PROGRAMMING
Output:
4 23ADL001-C PROGRAMMING
Program:
Result:
Thus, the C program perform basic arithmetic operations using different datatypes is developed
and executed successfully.
5 23ADL001-C PROGRAMMING
Flow Chart:
Start
Get Radius
Compute
area=Pi*r*r
Display
area
Stop
6 23ADL001-C PROGRAMMING
1-b) Create a C program to calculate the area of a circle (floating-point arithmetic).
Aim:
To develop a C program to find the area of the circle using the formula.
Algorithm:
7 23ADL001-C PROGRAMMING
Output:
8 23ADL001-C PROGRAMMING
Program:
Result:
Thus, the C program for area of the circle for the given radius is developed and executed
successfully.
9 23ADL001-C PROGRAMMING
Flow Chart:
Start
Get a
character
Vowel or
not
True
False
Display
Vowel
Display
Consonant
Stop
10 23ADL001-C PROGRAMMING
1-c) Implement a C program that takes a character as input and checks whether it is a vowel or a
consonant.
Aim:
Algorithm:
Step4: Use if else to find whether the given character is vowel or consonant.
11 23ADL001-C PROGRAMMING
Output:
12 23ADL001-C PROGRAMMING
Program:
Program Execution 25
Output 20
Viva 10
Total 75
Result:
Thus, the C program to find whether the entered character is vowel or consonant is developed and executed
successfully.
13 23ADL001-C PROGRAMMING
Flow Chart:
Start
Get A&B
Compute c=a%b
Display C
Stop
14 23ADL001-C PROGRAMMING
2. Implement programs using Operators and Expressions
2-a) Create a program that calculates and prints the remainder when dividing two integers.
Aim:
Algorithm:
15 23ADL001-C PROGRAMMING
Output:
16 23ADL001-C PROGRAMMING
Program:
Result:
17 23ADL001-C PROGRAMMING
Flow Chart:
Start
Get A&B
Compute a++,b--
Display a,b
Stop
18 23ADL001-C PROGRAMMING
2-b) Write a program that demonstrates the use of increment and decrement operators.
Aim:
Algorithm:
19 23ADL001-C PROGRAMMING
Output:
20 23ADL001-C PROGRAMMING
Program:
Result:
Thus, the C program for increment and decrement operator is developed and executed
successfully.
21 23ADL001-C PROGRAMMING
Flow Chart:
Start
Get num1,num2
False
If
num1>num2
Display Num1 is
greater
Stop
22 23ADL001-C PROGRAMMING
2-c) Implement a program to compare two numbers using relational operators (>, <, >=, <=, ==,!=)
Aim:
To develop a C program to compare two numbers using relational operators, bitwise operators,
logical and assignment operators.
Algorithm:
Step3: Assign the two numbers with a suitable variable as num1, num2.
Step4: Compute the result using various operators using if else condition.
23 23ADL001-C PROGRAMMING
Output:
24 23ADL001-C PROGRAMMING
Program:
Program Execution 25
Output 20
Viva 10
Total 75
Result:
Thus, the C program for using operators is developed and executed successfully.
25 23ADL001-C PROGRAMMING
Flow Chart:
26 23ADL001-C PROGRAMMING
3. Develop Programs using Branching statements
3-a) Write a program that takes an integer as input and prints whether it is positive, negative, or zero
using if-else statements.
Aim:
Algorithm:
27 23ADL001-C PROGRAMMING
Output:
28 23ADL001-C PROGRAMMING
Program:
Result: Thus, the C program for finding whether the given integer is positive or negative or zero is
developed and executed successfully.
29 23ADL001-C PROGRAMMING
Flow Chart:
Start
Get a
character
if year%4==0 True
False
Display
Leap Year
Display Not
Leap Year
Stop
30 23ADL001-C PROGRAMMING
3-b) Implement a program that checks whether a given year is a leap year using conditional
statements.
Aim:
Algorithm:
31 23ADL001-C PROGRAMMING
Output:
32 23ADL001-C PROGRAMMING
Program:
Result:
Thus, the C program to find leap year or not is developed and executed successfully.
33 23ADL001-C PROGRAMMING
Flow Chart:
34 23ADL001-C PROGRAMMING
3-c) Implement a calculator program to do simple commercial calculator operations like addition,
subtraction, multiplication and division using a switch case statement.
Aim:
Algorithm:
35 23ADL001-C PROGRAMMING
Program:
36 23ADL001-C PROGRAMMING
Output:
37 23ADL001-C PROGRAMMING
Result:
Thus, the C program for Simple Calculator is developed and executed successfully.
38 23ADL001-C PROGRAMMING
Flow Chart:
39 23ADL001-C PROGRAMMING
3-d) Implement a program that uses a ‘for’ loop to calculate the factorial of a given number.
Aim:
To develop a C program to calculate factorial of the given number using for loop.
Algorithm:
Step3: Assign it as n.
40 23ADL001-C PROGRAMMING
Output:
41 23ADL001-C PROGRAMMING
Program:
Program Execution 25
Output 20
Viva 10
Total 75
Result:
Thus, the C program for factorial has developed and executed successfully.
42 23ADL001-C PROGRAMMING
43 23ADL001-C PROGRAMMING
4. Implement Programs using Control Structures
4a) Write a program to generate the Fibonacci series up to a given number using a while loop.
Aim:
Algorithm:
44 23ADL001-C PROGRAMMING
Output:
45 23ADL001-C PROGRAMMING
Program:
Result:
Thus, the C program for Fibonacci series is developed and executed successfully.
46 23ADL001-C PROGRAMMING
47 23ADL001-C PROGRAMMING
4-b) Write a program that checks whether a given number is an Armstrong number or not using
loops and conditionals.
Aim:
Algorithm:
48 23ADL001-C PROGRAMMING
Program:
49 23ADL001-C PROGRAMMING
Output:
Program Execution 25
Output 20
Viva 10
Total 75
Result:
Thus, the C program to find Armstrong number is developed and executed successfully.
50 23ADL001-C PROGRAMMING
51 23ADL001-C PROGRAMMING
5. Develop programs using Arrays
5-a) Create a program that finds the largest and smallest elements in an array of numbers.
Aim:
To develop a C program to perform operations on one dimensional and two dimensional array.
Algorithm:
Step 1:Create two intermediate variables small and large.
Step2: Initialize the small and large variable with arr[0].
Step3: Now traverse the array iteratively and keep track of the smallest and largest element until the end of
the array.
Step4: In the last, will get the smallest and largest number in the variable small and large respectively.
Step5: Print both the variables.
52 23ADL001-C PROGRAMMING
Output:
53 23ADL001-C PROGRAMMING
Program:
Result:
Thus, the C program to find largest and smallest elements in array is developed and executed
successfully.
54 23ADL001-C PROGRAMMING
55 23ADL001-C PROGRAMMING
5-b) Create a program to add two matrices and print the result.
Aim:
Algorithm:
56 23ADL001-C PROGRAMMING
Output:
57 23ADL001-C PROGRAMMING
Program:
58 23ADL001-C PROGRAMMING
59 23ADL001-C PROGRAMMING
Rubrics Maximum Marks
Score Obtained
Program Execution 25
Output 20
Viva 10
Result: Total 75
Thus, the C program to perform Matrix Addition is developed and executed successfully.
60 23ADL001-C PROGRAMMING
61 23ADL001-C PROGRAMMING
6. Implement programs using Functions
6-a) Write a program that checks whether a given number is prime using a function.
Aim:
To develop a C program to check whether the number is prime or not using function.
Algorithm:
Step 1: Declare the function primenumber
Step 2. Using for loop to check given number is prime or not
Step 3. Display the prime number or not
Program:
Result:
62 23ADL001-C PROGRAMMING
Output:
63 23ADL001-C PROGRAMMING
6-b) Develop a program that calculates the sum of elements in an array using a separate function.
Aim:
Algorithm:
Step 1: Declare the array variable arr
Step 2: Find the length of the array
Step 3: Using for loop to find the sum of an array
Step 4: Display the sum of array elements
Program:
Result:
64 23ADL001-C PROGRAMMING
65 23ADL001-C PROGRAMMING
6-c) Create a program that reverses the elements of an array using a function.
Aim:
Algorithm:
Step 1: Declare the reverseArray function
Step 2: Using the while loop to swap the array elements
Step 3: Using the printarray function to display array elements
Step 4: Display the array elements in reverse order
Program
66 23ADL001-C PROGRAMMING
67 23ADL001-C PROGRAMMING
Rubrics Maximum Marks
Score Obtained
Program Execution 25
Output 20
Viva 10
Total 75
Result:
Thus, the C program to reverse the elements of an array is developed and executed successfully.
68 23ADL001-C PROGRAMMING
69 23ADL001-C PROGRAMMING
7. Implement programs using String Operations
Aim:
Algorithm:
Step 1: Start the Program
Step 2: Get a string from the user by using Runtime Input
Step 3: find the length of a string, concatenate two strings, reverse a string and compare two strings using
string functions like strlen(), strcat(), strrev(), strcmp(), strcpy() .
Step 4: Display the output.
Step5: Stop the Program
Program:
70 23ADL001-C PROGRAMMING
Output:
71 23ADL001-C PROGRAMMING
Result:
72 23ADL001-C PROGRAMMING
7-b) Implement a program that checks whether a given string is a palindrome or not.
Aim:
Algorithm:
Step 1. Start
Step 2. Read the string from the user
Step 3. Calculate the length of the string
Step 4. Initialize rev = “ ” [empty string]
Step 5. Initialize i = length - 1
Step 6. Repeat until i>=0:
6.1: rev = rev + Character at position ‘i’ of the string
6.2: i = i – 1
Step 7. If string = rev:
7.1: Print “Given string is palindrome”
Step 8. Else:
8.1: Print “Given string is not palindrome”
Step 9. Stop
73 23ADL001-C PROGRAMMING
Output:
74 23ADL001-C PROGRAMMING
Program:
Program Execution 25
Output 20
Viva 10
Total 75
Result:
Thus, the C programto check whether the string is palindrome or not is developed and executed
successfully.
75 23ADL001-C PROGRAMMING
Output:
76 23ADL001-C PROGRAMMING
8. Develop programs using Pointers
Aim:
ALGORITHM:
Step 1: Start the process.
Step 2: Get need inputs.
Step 3: Perform basic arithmetic operations using pointer.
Step 4: Display the result.
Step 5: Stop the process.
PROGRAM:
77 23ADL001-C PROGRAMMING
Rubrics Maximum Marks
Score Obtained
Program Execution 25
Output 20
Viva 10
Total 75
Result:
Thus, the C program isto perform arithmetic operations using pointers developed and executed
successfully.
78 23ADL001-C PROGRAMMING
9. Implement programs using Structures
Aim:
Algorithm:
Step 1: Start the process.
Step 2: Get Name, Roll no, Mark1, Mark2, Mark3 as input for N students.
Step 3: Calculate total marks and average for N students.
Step 4: Display the result.
Step 5: Stop the process.
Program:
79 23ADL001-C PROGRAMMING
Output:
80 23ADL001-C PROGRAMMING
Rubrics Maximum Marks
Score Obtained
Program Execution 25
Output 20
Viva 10
Total 75
Result:
Thus, the C program to display the information of N students using structure is developed and
executed successfully.
81 23ADL001-C PROGRAMMING
10. Develop programs using Union
Aim:
Algorithm:
Step 1: Start the Program
Step 2: Declare union called Employee with name, department and salary as fields.
Step 3: Declare the necessary union variables.
Step 4: Initialize the field values
Step 5: print the employee details.
Step 6: Stop the Program
Program:
82 23ADL001-C PROGRAMMING
Output:
83 23ADL001-C PROGRAMMING
Rubrics Maximum Score Marks Obtained
Program Execution 25
Output 20
Viva 10
Total 75
Result:
Thus, the C program is to display the employee details using union is developed and executed
successfully.
84 23ADL001-C PROGRAMMING
85 23ADL001-C PROGRAMMING