ITP Exercise-2
Topic -Introduction to Computer Programming
School of Computing and Data Science
Sai University, Chennai
1.Write a C program to input 5 integers into an array and display
them.
2. Write a C program to find the sum and average of elements in an
array.
3. Write a C program to find the largest and smallest elements in an
array.
4. Write a C program to count even and odd numbers in an array.
5. Write a C program to reverse the elements of an array.
6. Write a C program to search an element in an array using linear
search.
7. Write a C program to find the frequency of each element in an
array.
8. Write a C program to find the sum of diagonal elements of a
square matrix (2D Matrix).
9. Write a C program to input marks of N students and find their
total and average marks.
10. Write a C program to count positive, negative, and zero
elements in an array.
11. Write a C program to find the sum of even-indexed and
odd-indexed elements separately.
12. Write a C program to swap the first and last elements of an
array.
13. Write a C program to check whether an array is sorted in
ascending order or not.
14. Write a C program to input and display a matrix of size m x n.
15. Write a C program to find the sum of all elements of a 2D
matrix.
16. Write a C program to find the transpose of a matrix.
17. Write a C program to add two matrices.
18. Write a C program to find the trace (sum of diagonal elements)
of a matrix.
1
19. Write a C program to check if a matrix is symmetric.
20. Write a C program to find the sum of each row and each
column of a matrix.
21. Write a C program to count the number of zero elements in a
matrix (sparse matrix check).
22. Write a C program to find the maximum value in an array.
23. Write a C program to find the minimum value in an array.
24. Write a C program to find the sum of even elements in an
array.
25. Write a C program to find the sum of odd elements in an
array.
26. Write a C program to find the product of all elements in an
array.