Nothing Special   »   [go: up one dir, main page]

Programming For Problem Solving Using C Lab (20-21)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

PROGRAMMING FOR PROBLEM SOLVING USING C LAB

(Common to all branches)

Course Code: 20CT1102 L T P C


0 0 3 1.5

Course Outcomes: At the end of the Course the student shall be able to
CO1: apply the concepts of variables, data types, operators and expressions.(L3)
CO2: demonstrate the usage of Conditional and Unconditional statements. (L3)
CO3: demonstrate the usage of functions and relate functions with respect to arrays and strings.
(L3)
CO4: implement the concept of pointers and structures. (L3)
CO5: demonstrate the usage of files and Command Line Arguments. (L3)

List of Programs: (Any Twelve programs should be carried out)

1. Basic Programs
A. C program to display hello world message.
B. C program to scan all data type variables as input and print it as output.
C. C program to perform arithmetic operations like +,-,*,/,% on two input variables.
D. C program to perform temperature conversions from Centigrade to Fahrenheit and vice versa.

2. Programs on Operators
A. C program to scan an input and perform pre and post increment operation on it and display the
result.
B. C program to perform all bit wise operations.
C. C program to extract the last two digits of a given integer n, where the number of digits
should be greater than 2.
D. C program to display the greatest of three numbers using a conditional operator.
E. C program to swap two numbers without using a third variable.

3. Programs on Conditional Statements


A. C program to check whether a given input integer is in between two values x and y.
B. C program to check whether a given character is a vowel or a consonant or a digit or a special
symbol.
C. C program to display the nature of roots of a quadratic equation.
D. C program to perform arithmetic operations using switch statement.
E. C program to convert upper case character to lowercase and vice versa.

4. Programs on Loop Statements


A. C program to print odd numbers between specified ranges.
B. C program to display the factors of a given number and check whether it is a prime or not.
C. C program to display the sum of individual digits of a given integer raised to the power of n.
Also check whether the given integer is Armstrong or not.
D. C Program to demonstrate the usage of unconditional control statements.
E. C program to display the following pattern.
54321
4321
321
21
1

5. Programs on Functions
A. C program to demonstrate the various categories of functions with respect to return type and
number of arguments.
B. C program to find the LCM of two numbers using functions.
C. Create a header file which contains the following prototype:
i. int factorial(int) ; // non-recursive function
ii. int factorial_rec(int); //Recursive function
iii. int prime(int);
Use the above functions in a C program by including the above header file. D.
C program to display Pascal’s triangle using functions.

6. Programs on Arrays
A. C program to read n integer values into an array and display them
B. C program to count and display the number of positive, negative, even and odd numbers in a
given array of integers and also display their sum.
C. C program to find the smallest and largest numbers in an array of integers.
D. C program to perform addition, multiplication, transpose of given matrices using functions.
E. C program to check whether a given integer exists in a list of numbers and print its index
value if it is present, otherwise print “No”.

7. Programs on Strings
A. C program to convert upper case character to lowercase and vice versa in a given string.
B. C program to delete all vowels in a given string and display the remaining string.
C. C program to check whether a given string is palindrome or not.
D. C program that reads two integers as strings and displays their sum.

8. Programs on Strings
A. C program to demonstrate the usage of at least 10 predefined string handling
functions.
B. C program that implements the following user defined string handling functions
i. To find the length of the given string
ii. To copy the contents of one string to another
iii. To reverse the contents of a string
iv. To compare two strings
v. To concatenate two strings

9. Programs on Pointers and Dynamic Memory Allocation


A. C program to demonstrate the usage of pointers.
B. C program that uses dynamic memory allocation functions to add n elements and display their
average.
C. C program that performs pointer arithmetic.
D. C program that implements call by reference.
10. Programs on Pointers
A. C program to demonstrate the following
i. Pointers to Pointers
ii. Array of Pointers iii.
Pointer to Array iv.
Pointers to Functions

11. Programs on Structures


A. C program to access and display the members of the structure.
B. C program that demonstrates different ways to access the structure elements using pointers.

12. Programs on Files


A. C program to read the contents of a file and display on the output screen.
B. C program to copy the contents of one file to another.
C. C program to count and display the number of characters, words and lines in a file.
D. C program to print last n characters of a file by reading file name and n value from command
line.

13. C program to replace all the vowels in a given string with a given character

14. C program to perform arithmetic operations using command line arguments

15. C program that writes the contents to a file and reads the contents from a file using structures.

Reference Books:
1. Ashok N Kamthane, Amit Ashok Kamthane, Programming in C, 3rd Edition, Pearson
Publication 2015.
2. Herbert Schildt, The Complete Reference C, 4th Edition,Tata McGraw-Hill, 2017.
3. Brian W. Kernighan and Dennis M. Ritchie, The C Programming Language, 2nd Edition,
Prentice-Hall, 2015.
4. Rajaraman V, The Fundamentals of Computer, 6th Edition, Prentice-Hall of India, 2014.
5. Steve Oualline, Practical C Programming, 3rd Edition, O’Reilly Press, 2006.
6. Balagurusamy E, Programming in ANSI C, 8th Edition, Tata McGraw-Hill, 2019.
7. Gottfried, Programming with C, 3rd Edition, Tata McGraw-Hill, 2018.

Web References:

1. https://onlinecourses.nptel.ac.in/noc19_cs42/preview
2. https://www.programiz.com/c-programming

You might also like