Programming in C Lab Exercises
Programming in C Lab Exercises
3. Read a Natural Number and check whether the number is prime or not
4. Read a Natural Number and check whether the number is Armstrong or not
5. Read n integers, store them in an array and find their sum and average
7. Read n integers, store them in an array and sort the elements in the array
using Bubble Sort algorithm
8. Read a string (word), store it in an array and check whether it is a palindrome word
or not.
9. Read two strings (each one ending with a $ symbol), store them
in arrays and concatenate them without using library functions.
10. Read a string (ending with a $ symbol), store it in an array and count the
number of vowels, consonants and spaces in it.
11. Read two input each representing the distances between two points in the
Euclidean space, store these in structure variables and add the two distance
values.
12. Using structure, read and print data of n employees (Name, Employee Id and
Salary)
13. Declare a union containing 5 string variables (Name, House Name, City Name,
State and Pin code) each with a length of C_SIZE (user defined constant). Then,
read and display the address of a person using a variable of the union.
14. Find the factorial of a given Natural Number n using recursive and non-recursive
functions
15. Read a string (word), store it in an array and obtain its reverse by using a user
defined function.
16. Write a menu driven program for performing matrix addition, multiplication
and finding the transpose. Use functions to (i) read a matrix, (ii) find the sum
of two matrices, (iii) find the product of two matrices, (i) find the transpose
of a matrix and (v) display a matrix.
19. Compute sum of the elements stored in an array using pointers and user defined
function.
21.Open a text input file and count number of characters, words and lines in it;
and store the results in an output file.