Laboratory-CSD105A_Programming InC
Laboratory-CSD105A_Programming InC
Programming in C
B.Tech. 2nd Semester
Name : P SNEHA
Reg Number : 23ETCS002083
Programme : Btech
Department :Computer Science Engineering
1
Name: ____________________________ Registration Number:_____________________
Ramaiah University of Applied Sciences
Private University Established in Karnataka State by Act No. 15 of 2013
List of Experiments
Introduction to C programs
Conditional statements
Loops and Arrays
Functions and Recursion
Pointers
Structures
Files
2
Name: ____________________________ Registration Number:_____________________
Index Sheet
No Lab Experiment Lab document Viva
3
Name: ____________________________ Registration Number:_____________________
Laboratory 1
Title of the Laboratory Exercise: Introduction to C programming
3. Experimental Procedure
Students are given a set of C programs. Edit and execute C programs using netbeans IDE
i. Analyse the problem statement
ii. Problem solving approach for the given problem statement and develop
algorithm
iii. Implement the algorithm in C language
iv. Execute the C program
v. Test the implemented program
vi. Document the Results
vii. Analyse and discuss the outcomes of the experiment
4. Questions
4
Name: ____________________________ Registration Number:_____________________
a)
ii. Algorithm
A) Algorithm
begin
writeln(“ Hello World “)
end
b)
a)
i) Program
A)
ii) Test cases
b)
7. Summary
5
Name: ____________________________ Registration Number:_____________________
6
Name: ____________________________ Registration Number:_____________________
Laboratory 2
Title of the Laboratory Exercise: Conditional statements
1. Introduction and Purpose of Experiment
C provides number of control flow instructions/statements to control the flow of program
execution conditionally. By solving the problems, students will be able to apply conditional
control statements to control the program execution.
2. Aim and Objectives
Aim
To develop programs involving branching using appropriate control statements in
C
Objectives
At the end of this lab, the student will be able to
Apply conditional control statements such as if-else and nested if-else to express
decisions
3. Experimental Procedure
viii. Analyse the problem statement
ix. Problem solving approach for the given problem statement and develop
algorithm
x. Implement the algorithm in C language
xi. Execute the C program
xii. Test the implemented program
xiii. Document the Results
xiv. Analyse and discuss the outcomes of the experiment
4. Questions
7
Name: ____________________________ Registration Number:_____________________
ii. Algorithm
b)
a)
i) Program
b)
7. Summary
8
Name: ____________________________ Registration Number:_____________________
Laboratory 3
Title of the Laboratory Exercise: Loops and Arrays
3. Experimental Procedure
i. Analyse the problem statement
ii. Problem solving approach for the given problem statement and develop algorithm
iii. Implement the algorithm in C language
iv. Execute the C program
v. Test the implemented program
vi. Document the Results
vii. Analyse and discuss the outcomes of the experiment
4. Questions
a. Write a C program which uses the formula C= (5/9)*(F-32) to print a table of Fahrenheit
temperatures and their centigrade or Celsius equivalents from 1 to 300 Fahrenheit
temperature.
9
Name: ____________________________ Registration Number:_____________________
ii. Algorithm
b)
i) Program
b)
7. Summary
10
Name: ____________________________ Registration Number:_____________________
Laboratory 4
Title of the Laboratory Exercise: Functions and Recursion
1. Introduction and Purpose of Experiment
A function serves as an abstraction mechanism to view many things as one thing. The
function definition specifies the name of a new function and the sequence of statements
that execute when the function is called. Once a function is defined, it can be called as many
times as required. By solving these problems, students will be able to create user defined
functions. A recursive function solves a particular problem by calling a copy of itself and
solving smaller sub-problems of the original problems.
4. Questions
a) Write a C program to determine the type of a triangle using functions.
fibonacci numbers
factorial
power
11
Name: ____________________________ Registration Number:_____________________
ii. Algorithm
b)
i) Program
b)
7. Summary
12
Name: ____________________________ Registration Number:_____________________
Laboratory 5
Title of the Laboratory Exercise: Pointers
3. Experimental Procedure
i. Analyse the problem statement
ii. Problem solving approach for the given problem statement and develop algorithm
iii. Implement the algorithm in C language
iv. Execute the C program
v. Test the implemented program
vi. Document the Results
vii. Analyse and discuss the outcomes of the experiment
4. Questions
a) Write a C program to swap two numbers using pointers
b) Write a C program to perform the following using pointers
I. String copy
II. String compare
III. String length
13
Name: ____________________________ Registration Number:_____________________
ii. Algorithm
b)
i) Program
b)
7. Summary
14
Name: ____________________________ Registration Number:_____________________
Laboratory 6
Title of the Laboratory Exercise: Structures
3. Experimental Procedure
i. Analyse the problem statement
ii. Problem solving approach for the given problem statement and develop algorithm
iii. Implement the algorithm in C language
iv. Execute the C program
v. Test the implemented program
vi. Document the Results
vii. Analyse and discuss the outcomes of the experiment
4. Questions
a. Write a C program to create and display a record for each student in your class with
fields Reg no, Name and Age.
b. Modify the above program to calculate grade for each subject for all students in 1 st
semester.
ii. Algorithm
15
Name: ____________________________ Registration Number:_____________________
b)
i) Program
b)
7. Summary
16
Name: ____________________________ Registration Number:_____________________
Laboratory 7
Title of the Laboratory Exercise: File handling
3. Experimental Procedure
i. Analyse the problem statement
ii. Problem solving approach for the given problem statement and develop algorithm
iii. Implement the algorithm in C language
iv. Execute the C program
v. Test the implemented program
vi. Document the Results
vii. Analyse and discuss the outcomes of the experiment
4. Questions
a. Write a C program to copy the contents from one file to another.
b. Write a C program to count characters, word and lines in a given file.
17
Name: ____________________________ Registration Number:_____________________
ii. Algorithm
b)
i) Program
b)
7. Summary
18
Name: ____________________________ Registration Number:_____________________
19