Programming Questions
Operators & Expressions
1. Write a program to input two numbers and find their sum, difference, product, and
quotient.
2. Write a program to calculate the area and circumference of a circle using the formula.
3. Write a program to swap two numbers using a temporary variable and without using a
temporary variable.
4. Write a program to find the simple interest and compound interest.
5. Write a program to check whether a number is divisible by both 3 and 5.
Input / Output
6. Write a program to input marks of 5 subjects and display the total and percentage.
7. Write a program to input your name, roll number, and marks and display them in a formatted
output.
8. Write a program to read the radius of a sphere and print its volume.
Control Structures
9. Write a program to check whether a number is positive, negative, or zero.
10. Write a program to check whether the entered year is a leap year or not.
11. Write a program to find the greatest among three numbers.
12. Write a program to display the multiplication table of any number.
13. Write a program to print the Fibonacci series up to n terms.
14. Write a program to calculate the sum of digits of a number.
15. Write a program to check whether a number is prime or not.
Arrays
16. Write a program to find the sum and average of elements of an array.
17. Write a program to find the largest and smallest number in an array.
18. Write a program to sort an array in ascending order.
19. Write a program to find the second largest element in an array.
20. Write a program to add two matrices of size 3 × 3.
Strings
21. Write a program to find the length of a string without using library functions.
22. Write a program to reverse a string.
23. Write a program to check whether a string is a palindrome or not.
24. Write a program to count the number of vowels, consonants, digits, and spaces in a string.
25. Write a program to compare two strings without using strcmp().
User-defined Functions
26. Write a function to calculate factorial of a number and use it in the main program.
27. Write a function to check whether a number is prime.
28. Write a function to generate the Fibonacci series up to n terms.
29. Write a function to add two numbers and return the sum.
30. Write a function to calculate the power of a number (x^y).