0% found this document useful (0 votes)
36 views89 pages

C Programming Record Book

Manual.

Uploaded by

karthicksrujan16
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)
36 views89 pages

C Programming Record Book

Manual.

Uploaded by

karthicksrujan16
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/ 89

Dr.

Mahalingam College of Engineering and Technology, Pollachi

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

During the year

Staff-in-Charge Head of the Department

Submitted for the Autonomous End Semester Examination held on

Examiner1 Examiner2
23ADL001- C PROGRAMMING

S.NO DATE CONTENTS PG.NO SIGNATURE

OF FACULTY

1 Implement basic C programs using data types

2 Implement programs using Operators and Expressions

3 Develop Programs using Branching statements

4 Implement Programs using Control Structures

5 Develop programs using Arrays

6 Implement programs using Functions

7 Implement programs using String Operations

8 Develop programs using Pointers

9 Implement programs using Structures

10 Develop programs using Union

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

1-a)Write a program to perform basic arithmetic operations (addition, subtraction, multiplication,


division) on different datatypes.

Aim:

To develop a C program to perform basic arithmetic operations using various datatypes.

Algorithm:

Step1: Start the program.

Step2: Get 2 Numbers as input from the user.

Step3: Assign the two numbers with a suitable variable as a,b.

Step4: Perform basic arithmetic operations such as sum,difference,product,quotient.

Step5: Display the Output.

Step6: Stop the program.

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:

Step1: Start the program.

Step2: Define Pi as 3.14.

Step3: Get Radius as input from the user.

Step4: Assign the radius as r.

Step5: Now calculate Pi*r*r and assign it as area.

Step6: Display the Output.

Step7: Stop the program.

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:

To develop a C program to find whether the entered character is vowel or consonant.

Algorithm:

Step1: Start the program.

Step2: Get a character as input from the user.

Step3: Pass the character to the process.

Step4: Use if else to find whether the given character is vowel or consonant.

Step5: Display the Output.

Step6: Stop the program.

11 23ADL001-C PROGRAMMING
Output:

12 23ADL001-C PROGRAMMING
Program:

Rubrics Maximum Marks


Score Obtained

Aim and Algorithm 20

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:

To develop a C program to print the remainder when dividing two integers.

Algorithm:

Step1: Start the program.

Step2: Get 2 Numbers as input from the user.

Step3: Assign the two numbers with a suitable variable as a,b.

Step4: Compute c=a%b.

Step5: Display the Output.

Step6: Stop the program.

15 23ADL001-C PROGRAMMING
Output:

16 23ADL001-C PROGRAMMING
Program:

Result:

Thus, the C program to find remainder is developed and executed successfully.

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:

To develop a C program to demonstrate the use of increment and decrement operators.

Algorithm:

Step1: Start the program.

Step2: Get 2 Numbers as input from the user.

Step3: Assign the two numbers with a suitable variables as a,b.

Step4: Compute a++,b--.

Step5: Display the Output.

Step6: Stop the program.

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

True Display Num2 is


greater

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:

Step1: Start the program.

Step2: Get 2 Numbers as input from the user.

Step3: Assign the two numbers with a suitable variable as num1, num2.

Step4: Compute the result using various operators using if else condition.

Step5: Display the Output.

Step6: Stop the program.

23 23ADL001-C PROGRAMMING
Output:

24 23ADL001-C PROGRAMMING
Program:

Rubrics Maximum Marks


Score Obtained

Aim and Algorithm 20

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:

To develop a C program to find whether it is positive or negative or zero.

Algorithm:

Step1: Start the program.

Step2: Get an integer as input from the user.

Step3: Assign the integer as a.

Step4: Check whether the given number is positive or negative or zero.

Step5: Display the Output.

Step6: Stop the program.

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:

To develop a C program to whether the given year is leap year or not.

Algorithm:

Step1: Start the program.

Step2: Get a year as input from the user.

Step3: Assign the year as year.

Step4: Compute year%4==0 or not.

Step5: Display the Output.

Step6: Stop the program.

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:

To develop a C program to perform calculator operations using switch case.

Algorithm:

Step1: Start the program.

Step2: Get two values, choice as input from the user.

Step3: Assign the choice as x and two values as a,b .

Step4: Now perform the Calculator operations.

Step5: Display the Output.

Step6: Stop the program.

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:

Step1: Start the program.

Step2: Get an integer as input from the user.

Step3: Assign it as n.

Step4: Now perform the factorial calculation.

Step5: Display the Output.

Step6: Stop the program.

40 23ADL001-C PROGRAMMING
Output:

41 23ADL001-C PROGRAMMING
Program:

Rubrics Maximum Marks


Score Obtained

Aim and Algorithm 20

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:

To develop a C program to generate the Fibonacci series.

Algorithm:

Step1: Start the program.

Step2: Get a positive integer as an input from the user.

Step: Display the output.

Step: Stop the program

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:

To develop a C program to check whether the given number is Armstrong or not.

Algorithm:

Step1: Start the program.

Step2: Declare the name of the function in declaration part.

Step3: call the function.

Step4: Define the function and execute the function.

Step5: Display the output.

Step6: Stop the program.

48 23ADL001-C PROGRAMMING
Program:

49 23ADL001-C PROGRAMMING
Output:

Rubrics Maximum Marks


Score Obtained

Aim and Algorithm 20

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:

To develop a C program to perform Matrix Addition.

Algorithm:

Step1: Start the program.

Step2: Get A & b matrix from the user.

Step3: Using for loop calculate matrix addition.

Step4: Display the output.

Step5: Stop the program.

56 23ADL001-C PROGRAMMING
Output:

57 23ADL001-C PROGRAMMING
Program:

58 23ADL001-C PROGRAMMING
59 23ADL001-C PROGRAMMING
Rubrics Maximum Marks
Score Obtained

Aim and Algorithm 20

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:

Thus,the C program to implement functions is developed and executed successfully.

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:

To develop a C program to calculate sum of elements in an array using function.

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:

Thus, the C program to implement functions is developed and executed successfully.

64 23ADL001-C PROGRAMMING
65 23ADL001-C PROGRAMMING
6-c) Create a program that reverses the elements of an array using a function.

Aim:

To develop a C program to reverse the elements of an array using function.

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

Aim and Algorithm 20

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

7-a) Write a C program to manipulate strings using string functions.

Aim:

To develop a C program to manipulate strings using string functions.

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:

Thus, the C program to manipulate strings is developed and executed successfully.

72 23ADL001-C PROGRAMMING
7-b) Implement a program that checks whether a given string is a palindrome or not.

Aim:

To develop a C program to check whether the string is palindrome or not.

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:

Rubrics Maximum Marks


Score Obtained

Aim and Algorithm 20

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

8) Write a C program to perform arithmetic operations using pointers.

Aim:

To develop a C program to perform arithmetic operations using pointers.

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

Aim and Algorithm 20

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

9) Create a C program to display the information of N students using structure.

Aim:

To develop a C program to display the information of N students using structure.

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

Aim and Algorithm 20

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

10) Create a C program to display the employee details using union.

Aim:

To develop a C program to display the employee details using union.

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

Aim and Algorithm 20

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy