Programming C Lab Manual (1)
Programming C Lab Manual (1)
W CREDIT
programming in C Credit Units: 3 UNITS
Course Level: UG Course Code: ES 202 2 - 2 - 3
Course Objectives: The objective of this course module is to acquaint the students with the basics of computers system, its components,
data representation inside computer and to get them familiar with various important features of procedure-oriented programming language
i.e. C. This Course guides the students to read, write and modify C programs and to implement basic projects.
Pedagogy for Course Delivery: The class will be taught using theory and lab method. Lab helps the students to generate the logic of assigned assignments. The
course instructor will spend considerable time in understanding the concept of C Programming Language from the scratch and covers most of the programming
structures of C Language. The course will cover the ways to think innovatively & liberally. Tools Used: TURBO C.Lab/ Practicals details, if applicable:
List of Experiments:
• Introduction to TURBO C IDE and Programming Environment.
• C Building Blocks
• Decision making the if and if-else structure
• Decision making the Switch case and conditional operator
• Loop Constructs in C Language
• Nested looping
• Functions in C-Language programming
• Arrays in C (single dimensional)
• Arrays in C (Multidimensional)
• Structures and Unions
• Pointers in C-Language
• Pointers with arrays and function
• File Handling in C-Language
67 33 100
Weightage (%) 5 15 10 10 60
a) Write a C program that shows all primary data type handling by creating variables.
b) Write a C program that perform all arithmetical operations.[ Hint: Addition, Subtraction, Multiplication, Division and Modulus]
1 c) Write a C program that calculate Area of circle. [Hint : Area of Circle =𝐴 = 𝜋𝑟 2 ]
a) Write a C Program that takes input any number from user and print the number is Odd or Even.
b) Write a C Program that takes input any two number from user and print the maximum number.
2 c) Write a C Program that takes input any year from user and print the year is leap year or not a leap year.
d) Write a C Program that takes input any number from user and print its last digit. [ Hint : 2346=> 6]
a) Write a C program to find out the average of 4 integers.
3
b) Write a C program to find the sum of individual digits of a given positiveinteger.
c) Write a C program to perform swapping variable values. [Hint: A=25 B=70 after swapping A=70 and B=25 ]
a) Write a C program to create a simple calculator using a switch case to perform basic operations like addition, subtraction,
4
multiplication, and division.
b) Develop a C program using a switch case to display the day of the week based on user input (1 for Monday, 2 for Tuesday, etc.).
c) Write a C program to check if the entered alphabet is vowel or a consonant.
a) Write a C program to print a right-angled triangle of numbers using nested loops.
5 b) Develop a C program to print the multiplication table (1 to 10) using nested loops.
c) Implement a C program that uses nested loops to generate a pyramid of stars based on the number of rows entered by the
user. [ In File]
d) Write a C program to print the Fibonacci series up to 'n' terms using a for loop. [ In File]
e) Develop a C program using a while loop to reverse a given integer. [In File ]
f) Implement a C program to find the factorial of a number using a do-while loop.
g) Write a C program to find the factorial of a given integer.
a) Write a C program to create a function that takes two integers as parameters and returns the greater of the two numbers.
6
b) Implement a C program that uses a recursive function to find the factorial of a given number. [In File ]
c) Develop a C program using functions to calculate the sum and average of an array of numbers entered by the user. [In File]
d) Write C program to find GCD of two integers by using recursive function.
e) Write C program to find GCD of two integers using non-recursive function. [ In File ]
a) Write a C program to find the largest and smallest number in a one-dimensional array. [In File ]
b) Develop a C program that sorts a one-dimensional array using the bubble sort algorithm. [In File]
7 c) Implement a C program to search for an element in a one-dimensional array using linear search. [In File ]
d) Write a C Program to Sort the Array in an Ascending Order.
a) Write a C program to create a file, write user input into it, and then read and display the contents of the file.
b) Implement a C program to count the number of words, lines, and characters in a given file.
13
c) Develop a C program that reads the contents of a text file and copies it into another file.
a) Write a C program that uses functions and structures to perform the followingoperations:
i) Reading a complex number
14 ii) Writing a complex number
iii) Addition of two complex numbers
iv) Multiplication of two complex numbers
b) Write a C program to display the contents of a file.
INSTRUCTIONS TO STUDENTS
• Before entering the lab the student should carry the following things (MANDATORY)
1. Identity card issued by the college.
2. Class notes
3. Lab Manual
4. Lab Record/File
• Student must sign in and sign out in the register provided when attending the lab sessionwithout fail.
• Come to the laboratory in time. Students, who are late more than 15 min., will not beallowed to attend the lab.
• Students need to maintain 100% attendance in lab if not a strict action will be taken.
• All students must follow a Dress Code while in the laboratory
• Foods, drinks are NOT allowed.
• All bags must be left at the indicated place.
• Refer to the lab staff if you need any help in using the lab.
• Respect the laboratory and its other users.
• Workspace must be kept clean and tidy after experiment is completed.
• Read the Manual carefully before coming to the laboratory and be sure about what youare supposed to do.
• Do the experiments as per the instructions given in the manual.
• Copy all the programs to observation which are taught in class before attending the labsession.
• Students are not supposed to use floppy disks, pen drives without permission of lab- incharge.
• Lab records need to be submitted on or before the date of submission.
How to write experiment in lab file a Sample Given.
Week 1:
Aim:=> Write a C program to find the sum and average of three numbers.
Procedure/ Steps:
Step 1: Start
sum←num1+num2 +num3
average ← sum/3
Step 6: Stop
Code:
#include<stdio.h>
int main( )
{
int a,b,c;
int sum,average;
printf("Enter any three integers: ");
scanf("%d%d %d",&a,&b,&c);
sum = a+b+c;
average=sum/3
printf("Sum and average of three integers: %d %d",sum,average);
return 0;
}
Output:
SAMPLE INPUT:
EXPECTED OUTPUT:
Learning Outcome:
1. Learn how to take three number input.
2. I can able to calculate sum of any numbers.
3. Understand how to calculate average and how I will display the result. Why different data type used.