C Programming Assignment – Arrays, Strings & Functions (20 Programs)
A. ARRAY PROGRAMS (8 Programs)
1. Find the maximum and minimum element in an array.
Write a program to input n integers into an array and print the largest and smallest element.
2. Calculate the sum and average of elements in an array.
Accept n numbers, store them in an array, and compute the total sum and average.
3. Reverse an array without using a second array.
Input an array and reverse it in-place.
4. Count the number of even and odd elements.
Read n integers and count how many are even and odd.
5. Copy the elements of one array to another.
Without using library functions, copy all elements from array A to array B.
6. Merge two arrays into a third array.
Take array A and B and merge them into array C.
7. Sort an array using Bubble Sort.
Implement bubble sort to sort an array in ascending order.
8. Search an element in an array using Linear Search.
Input an array and search a given element; if found, print its position.
B. STRING PROGRAMS (6 Programs)
9. Find the length of a string without using strlen().
Read a string and count the characters manually.
10. Reverse a string without using strrev().
Manually reverse the characters of a string.
11. Check if a string is palindrome.
Determine whether a given string reads the same forward and backward.
12. Count vowels, consonants, digits, and special characters.
Scan each character and categorize it accordingly.
13. Convert string to uppercase without using strupr().
Change lowercase letters to uppercase manually.
14. Concatenate two strings without using strcat().
Append the second string to the first using loops.
C. FUNCTION-BASED PROGRAMS (6 Programs)
15. Write a function to find the factorial of a number.
Use a user-defined function int factorial(int n).
16. Write a function to check whether a number is prime.
Function returns 1 if prime, else 0.
17. Write a function to calculate the Fibonacci series.
Use a function void fibonacci(int n) to print the first n terms.
18. Write a function to swap two numbers using call by reference.
Use pointers in the swap function.
19. Write a function to calculate the power of a number.
Implement int power(int base, int exp) manually without pow().
20. Write a menu-driven program using functions.
Menu:
1. Factorial
2. Prime check
3. Fibonacci
4. Exit
Call separate functions for each operation.