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

prog c

The document contains a series of programming tasks in C, covering various topics including control structures, arrays, strings, functions, and recursion. Each task specifies a different program to be written, such as determining leap years, generating Fibonacci sequences, and implementing a simple calculator. The tasks are organized into modules, each focusing on specific programming concepts and techniques.

Uploaded by

Skyy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

prog c

The document contains a series of programming tasks in C, covering various topics including control structures, arrays, strings, functions, and recursion. Each task specifies a different program to be written, such as determining leap years, generating Fibonacci sequences, and implementing a simple calculator. The tasks are organized into modules, each focusing on specific programming concepts and techniques.

Uploaded by

Skyy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

7. Write a C program to determine if a given year is a leap year.

8. Write a C program to print all prime numbers within a given range.

9. Write a C program to generate the Fibonacci sequence up to a given number of terms.

10. Write a C program to print the following pattern:


1

121
12321
1234321
123454321

11. Write a C program to find the greatest common divisor (GCD) of two numbers.

12. Write a C program to check if a number is an Armstrong number.

13. Write a program which takes integer input and then prints the number of even and odd digits
in that number.

14. Write a C program to simulate a simple calculator that performs addition, subtraction,
multiplication, or division based on user input.
15. Write a C program to generate Pascal’s Triangle up to a given number of rows.

16. Write a C program to find all Armstrong numbers within a given range.
17. Write a C program to print the following pattern (Diamond Pattern):

***

*****
*******

*******
*****
***

*
18. Write a C program to implement a simple menu-driven program for a bank account (deposit,
withdrawal, balance check).
19. Write a C program to check if a given number is a perfect number.

20. Write a C program to find the Least Common Multiple (LCM) of two numbers.

21. Write a C program to check if the given number is a strong number or not.

22. Write a C program to print all possible combinations of a 3 digit number, using 1,2,3 without
repeating digits.

Module 3: Array & String


1. Write a C program to find the sum of all elements in an array.
2. Write a C program to find the largest element in an array.

3. Write a C program to reverse an array.

4. Write a C program to count the number of vowels in a string.


5. Write a C program to check if a string is a palindrome.

6. Write a C program to concatenate two strings without using the `strcat()` function.

7. Write a C program to find the frequency of each character in a string.

8. Write a C program to perform matrix addition.

9. Write a C program to perform matrix multiplication.

10. Write a C program to sort an array of integers in ascending order using bubble sort.

11. Write a C program to search for a specific element in an array using binary search (assume
the array is sorted).

12. Write a C program to reverse each word in a given string.

13. Write a C program to remove all duplicate characters from a string.


14. Write a C program to count the number of words in a given string.

15. Write a C program to check if one string is an anagram of another.


16. Write a C program to rotate an array by a given number of positions.

17. Write a C program to find the transpose of a matrix.


18. Write a C program to implement a simple text editor (insert, delete, search).

19. Write a C program to find the longest common prefix among an array of strings.
20. Write a C program to implement a simple encryption/decryption algorithm (e.g., Caesar
cipher).

21. Write a C program to count the number of occurrences of a substring within a string.
22. Write a C program to sort an array of strings alphabetically.

23. Write a program to find the row and column with the maximum sum in a 2D array.

Module 4: Function & Recursion


1. Write a C function to calculate the factorial of a number and call it from the `main()` function.
2. Write a C function to swap two numbers using pointers.

3. Write a recursive function to calculate the Fibonacci series.

4. Write a recursive function to calculate the sum of digits of a given number.


5. Write a function that accepts an array and its size as input, and then returns the average of the
array’s elements.

6. Write a function to check if a number is armstrong or not.

7. Write a C function to find the maximum element in an array, passing the array and its size as
arguments.

8. Write a C function to check if a string is a palindrome.

9. Write a recursive function to calculate the power of a number (e.g., $x^y$).

10. Write a recursive function to find the factorial of a number.

11. Write a recursive function to reverse a string.

12. Write a function which takes an integer array and its size as input, and returns the second
largest element of the array.
13. Write a function to check if a number is perfect or not.
14. Write a function that accepts two matrices as input and returns their sum.
15. Write a recursive function to implement the Tower of Hanoi problem.

16. Write a recursive function to find the nth Fibonacci number efficiently (using memoization).

17. Write a function to perform matrix multiplication using pointers.

18. Write a function to find the sum of all prime numbers in a given range.
19. Write a recursive function to implement binary search.

20. Write a function to check if a given matrix is a sparse matrix.

21. Write a function that takes a string as input and returns a new string where all the vowels are
removed.

22. Write a function that accepts an array and its size as input, and then returns the mode of the
array’s elements.

You might also like