0% found this document useful (0 votes)
2 views

Programming C Lab Manual (1)

The document outlines a course titled 'Introduction to Computers and Programming in C' aimed at undergraduate students, focusing on computer basics and the C programming language. It includes course objectives, a detailed syllabus divided into modules covering topics from computer architecture to advanced C features, and a comprehensive assessment scheme. Additionally, it provides practical lab exercises and guidelines for students to follow during lab sessions.

Uploaded by

jerry482891
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)
2 views

Programming C Lab Manual (1)

The document outlines a course titled 'Introduction to Computers and Programming in C' aimed at undergraduate students, focusing on computer basics and the C programming language. It includes course objectives, a detailed syllabus divided into modules covering topics from computer architecture to advanced C features, and a comprehensive assessment scheme. Additionally, it provides practical lab exercises and guidelines for students to follow during lab sessions.

Uploaded by

jerry482891
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/ 5

Course Title: Introduction to Computers and L T P/S SW/F TOTAL

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.

Pre-requisites: Basic knowledge of Computers


Course Contents/Syllabus:
Weightage (%)
Module I: Introduction
Introduction to computer, history, von-Neumann architecture, memory system (hierarchy,
characteristics and types), H/W concepts (I/O Devices), S/W concepts (System S/W & 15
Application S/W, utilities). Data Representation: Number systems, character representation
codes, Binary, octal, hexadecimal and their interconversions. Binary arithmetic, floating
point arithmetic, signed and unsigned numbers, Memory storage unit.

Module II: Programming in C


History of C, Introduction of C, Basic structure of C program, Concept of variables, 20
constants and data types in C, Operators and expressions: Introduction, arithmetic,
relational, Logical, Assignment, Increment and decrement operator, Conditional, bitwise
operators, Expressions, Operator precedence and associativity. Managing Input and output
Operation, formatting I/O.

Module III: Fundamental Features in C


C Statements, conditional executing using if, else, nesting of if, switch and break Concepts 20
of loops, example of loops in C using for, while and do-while, continue and break. Storage
types (automatic, register etc.), predefined processor, Command Line Argument.

Module IV : Arrays and Functions


20
One dimensional arrays and example of iterative programs using arrays, 2-D arrays Use in
matrix computations. Concept of Sub-programming, functions Example of userdefined
functions. Function prototype, Return values and their types, calling function, function
argument, function with variable number of argument, recursion

Module V: Advanced features in C 25


Pointers, relationship between arrays and pointers Argument passing using pointers, Array
of pointers. Passing arrays as arguments. Strings and C string library. Structure and Union.
Defining C structures, Giving values to members, Array of structure, Nested structure,
passing strings as arguments. File Handling.
Course Learning Outcome: On completion of the course students will be able to
• Demonstrate the knowledge of Computer Science Basics
• Understand the basic programming constructs of C
• Apply Control Structures in C Programming Language
• Design applications using arrays and functions
• Create / manipulate data files and developing applications for real world problems.

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

Assessment/ Examination Scheme:

Theory L/T (%) Lab/Practical/Studio (%) Total

67 33 100

Theory Assessment (L&T):

Continuous Assessment/Internal Assessment 40 End Term


Examination
Components Attendance Mid Term Home Assignment Class Quiz
(Drop down) Exam

Weightage (%) 5 15 10 10 60

Lab/ Practical/ Studio Assessment:

Continuous Assessment/Internal End Term


Assessment 40 Examination
Components (Drop Attendance Lab Record Performance Viva
down) VIVA VOCE PRACTICAL
30 30
Weightage (%) 5 10 15 10 60

Text & References:


Text Books:
• Yashwant Kanetkar, “Let us C”, BPB Publications, 2010.
• Byron S Gottfried, “Schaum’s Outlines- Programming with C, Mc Graw Hill, 2008.
Reference Books:
• E Balagurusamy , “Programming in ANSI C”, Tata McGraw Hill, Fifth Edition, 2010.
• Herbert Schildt, “C: The complete references”, Tata McGraw Hill, Fourth Edition, 2008
• Brain W. Kernighan, Dennis Ritchie, “C Programming Language”, The (ANSI C Version), PHI, 2nd Edition, 1988.
CONTENTS
Week Name of the program

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.

8 a) Write a C program to add two 3x3 matrices.


b) Develop a C program to find the transpose of a 2x2 matrix.
c) Implement a C program to multiply two matrices (3x3) using multidimensional arrays.
a) Write a C program to define a structure for storing student information (name, roll number, and marks). Take input for 5 students
9 and display their details.
b) Implement a C program that uses a union to store a character and an integer, and demonstrate how the values of one variable
affect the other.
c) Develop a C program that uses structures to store the details of 3 employees (ID, name, salary) and displays the details of the
employee with the highest salary.
a) Write a C program that demonstrates the use of pointers by swapping two numbers using pointer variables. [ In File ]
b) Implement a C program to find the length of a string using pointers (without using the strlen function). [ In File ]
10
c) Develop a C program that uses a pointer to access and display the elements of an array. [In File ]
d) Write a C program to use the function to insert a sub-string in to given main stringfrom a given position.
e) Write a C program that uses functions to delete n Characters from a givenposition in a given string.
a) Write a C program that uses a function to find the sum of elements in an array, passing the array as a pointer. [ In File ]
b) Implement a C program that reverses the contents of an array using pointers. [In File ]
11
c) Develop a C program where a function returns a pointer to the largest element in an array.
d) Write a C program using user defined functions to determine whether thegiven string is palindrome or not. [ In File ]
e) Write a C program that displays the position or index in the main string Swhere the sub string T begins, or - 1 if S doesn't
contain T.
a) Write a C program to Display array elements using calloc( ) function.
12 b) Write a C Program to Calculate Total and Percentage marks of a student using structure.
c) Write a C program to find the length of the string using Pointer.

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.

a) Write a C program to merge two files into a third file.


15
b) Write a C program to reverse the first n characters in a file.
c) Write a C program to create a file , read/write record by record using structure.

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

Step 2: Declare variables num1, num2,num3 and sum,average.

Step 3: Read values num1,num2,num3

Step 4: Add num1,num2,num3 and assign the result to sum.

sum←num1+num2 +num3

average ← sum/3

Step 5: Display sum and average

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:

Enter any three integers:2 4 5

EXPECTED OUTPUT:

Sum and average of three integers: 11 3

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.

You might also like