List of basic programming exercises
List of basic programming exercises
List of basic programming exercises
1. Write a C program to check whether a number is prime, Armstrong or perfect number using functions
2. Write a C program to find factorial of any number using recursion.
3. Write a C program to generate nth Fibonacci term using recursion.
4. Write a C program to find cube of any number using function.
5. Write a C program to find diameter, circumference and area of circle using functions.
6. Write a C program to find maximum and minimum between two numbers using functions.
7. Write a C program to check whether a number is even or odd using functions.
8. Write a C program to find all prime numbers between given interval using functions.
9. Write a C program to print all strong numbers between given interval using functions.
10. Write a C program to print all Armstrong numbers between given interval using functions.
11. Write a C program to print all perfect numbers between given interval using functions.
12. Write a C program to print all natural numbers between 1 to n using recursion.
13. Write a C program to print all even or odd numbers in given range using recursion.
14. Write a C program to find sum of all natural numbers between 1 to n using recursion.
15. Write a C program to find sum of all even or odd numbers in given range using recursion.
16. Write a C program to find reverse of any number using recursion.
17. Write a C program to check whether a number is palindrome or not using recursion.
18. Write a C program to find sum of digits of a given number using recursion.
19. Write a C program to find GCD (HCF) of two numbers using recursion.
20. Write a C program to find LCM of two numbers using recursion.
21. Write a C program to display all array elements using recursion.
22. Write a C program to find sum of elements of array using recursion.
23. Write a C program to find maximum and minimum elements in array using recursion.
1. Write a C program to create a file and write contents, save and close the file.
2. Write a C program to read file contents and display on console.
3. Write a C program to read numbers from a file and write even, odd and prime numbers to separate file.
4. Write a C program to copy contents from one file to another file.
5. Write a C program to count characters, words and lines in a text file.
6. Write a C program to find occurrence of a word in a text file.
7. Write a C program to append content to a file.
8. Write a C program to compare two files.
9. Write a C program to merge two file to third file.
10. Write a C program to remove a word from text file.
11. Write a C program to remove specific line from a text file.
12. Write a C program to remove empty lines from a text file.
13. Write a C program to count occurrences of a word in a text file.
14. Write a C program to count occurrences of all words in a text file.
15. Write a C program to find and replace a word in a text file.
16. Write a C program to replace specific line in a text file.
17. Write a C program to print source code of same program.
18. Write a C program to convert uppercase to lowercase character and vice versa in a text file.
19. Write a C program to find properties of a file using stat() function.
20. Write a C program to check if a file or directory exists.
21. Write a C program to rename a file using rename() function.
22. Write a C program to list all files and sub-directories recursively.