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

C-program-Code-practice-Questions

It's good for learning c

Uploaded by

yadullahgoni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

C-program-Code-practice-Questions

It's good for learning c

Uploaded by

yadullahgoni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

‭C program Code practice Questions‬

‭ ## Basic Arithmetic Operations (Addition, Subtraction,‬


#
‭Multiplication, Division, Modulus)‬

‭ . Write a program to add two numbers.‬


1
‭2. Write a program to subtract two numbers.‬
‭3. Write a program to multiply two numbers.‬
‭4. Write a program to divide two numbers.‬
‭5. Write a program to find the remainder when one number is divided by another (modulus).‬
‭6. Write a program to swap two numbers using addition and subtraction.‬
‭7. Write a program to swap two numbers using multiplication and division.‬
‭8. Write a program to calculate the sum of three numbers.‬
‭9. Write a program to calculate the average of five numbers.‬
‭10. Write a program to find the area of a rectangle (length × breadth).‬
‭11. Write a program to find the perimeter of a rectangle (2 × (length + breadth)).‬
‭12. Write a program to calculate the area of a triangle (1/2 × base × height).‬
‭13. Write a program to calculate the circumference of a circle (2 × π × radius).‬
‭14. Write a program to calculate the area of a circle (π × radius²).‬
‭15. Write a program to find the square of a number.‬
‭16. Write a program to find the cube of a number.‬
‭17. Write a program to calculate the simple interest (P × R × T / 100).‬
‭18. Write a program to calculate compound interest (P × (1 + R/100)ⁿ).‬
‭19. Write a program to convert inches to centimeters (1 inch = 2.54 cm).‬
‭20. Write a program to convert Celsius to Fahrenheit (F = C × 9/5 + 32).‬
‭21. Write a program to convert Fahrenheit to Celsius (C = (F - 32) × 5/9).‬
‭22. Write a program to find the product of three numbers.‬
‭23. Write a program to calculate the sum of the squares of two numbers.‬
‭24. Write a program to calculate the square root of a number.‬
‭25. Write a program to find the cube root of a number.‬
‭26. Write a program to find the factorial of a number using a loop.‬
‭27. Write a program to calculate the factorial of a number recursively.‬
‭28. Write a program to calculate the sum of the first n natural numbers.‬
‭29. Write a program to find the nth power of a number.‬
‭30. Write a program to check whether a number is even or odd.‬
‭ 1. Write a program to check whether a number is positive, negative, or zero.‬
3
‭32. Write a program to check whether a number is divisible by both 3 and 5.‬
‭33. Write a program to find the largest of three numbers.‬
‭34. Write a program to find the smallest of three numbers.‬
‭35. Write a program to calculate the average of two numbers.‬
‭36. Write a program to check whether a number is a multiple of 7.‬
‭37. Write a program to check whether a number is divisible by 11.‬
‭38. Write a program to find the remainder of division between two numbers.‬
‭39. Write a program to calculate the sum of even numbers between 1 and n.‬
‭40. Write a program to calculate the sum of odd numbers between 1 and n.‬
‭41. Write a program to calculate the difference between the squares of two numbers.‬
‭42. Write a program to calculate the product of two numbers and subtract 10.‬
‭43. Write a program to add two numbers, subtract 5 from the result, and multiply the result by 2.‬
‭44. Write a program to calculate the result of an arithmetic expression (a + b) × c / d.‬
‭45. Write a program to calculate the result of an arithmetic expression ((a - b) * c) / (d + e).‬
‭46. Write a program to calculate the remainder of two numbers after dividing them.‬
‭47. Write a program to calculate the average of three numbers, multiply by 10.‬
‭48. Write a program to calculate the sum of squares of three numbers.‬
‭49. Write a program to calculate the difference between the sum of two numbers and their product.‬
‭50. Write a program to find the absolute difference between two numbers.‬

‭ ## Advanced Arithmetic Operations (Power, Average, Complex‬


#
‭Calculations)‬

‭ 1. Write a program to calculate the nth Fibonacci number using an arithmetic formula.‬
5
‭52. Write a program to check if the sum of digits of a number is divisible by 3.‬
‭53. Write a program to calculate the perimeter of a triangle (a + b + c).‬
‭54. Write a program to convert kilometers to miles.‬
‭55. Write a program to convert grams to kilograms.‬
‭56. Write a program to convert minutes to seconds.‬
‭57. Write a program to calculate the average of three floating-point numbers.‬
‭58. Write a program to calculate the weighted average of three numbers.‬
‭59. Write a program to compute the area of a right triangle given base and height.‬
‭60. Write a program to calculate the volume of a cylinder (π × radius² × height).‬
‭61. Write a program to calculate the surface area of a sphere (4 × π × radius²).‬
‭62. Write a program to calculate the area of a trapezoid.‬
‭ 3. Write a program to calculate the total cost of an item after applying a discount.‬
6
‭64. Write a program to calculate the time required to travel a given distance at a given speed.‬
‭65. Write a program to check whether a year is a leap year or not.‬
‭66. Write a program to calculate the area of a parallelogram.‬
‭67. Write a program to calculate the area of a rhombus.‬
‭68. Write a program to calculate the profit or loss after buying and selling a product.‬
‭69. Write a program to calculate the cost of painting a rectangular room.‬
‭70. Write a program to calculate the monthly salary of an employee after tax deductions.‬
‭71. Write a program to calculate the profit percentage from cost and selling price.‬
‭72. Write a program to calculate the discounted price of an item after applying a given percentage‬
‭discount.‬
‭73. Write a program to convert a given time in seconds to hours, minutes, and seconds.‬
‭74. Write a program to find the area of a sector of a circle (θ × π × radius² / 360).‬
‭75. Write a program to compute the length of the hypotenuse of a right triangle using Pythagoras‬
‭theorem.‬
‭76. Write a program to compute the average speed for a journey when distances and times are‬
‭given.‬
‭77. Write a program to calculate the sum of cubes of the first n natural numbers.‬
‭78. Write a program to compute the roots of a quadratic equation using the quadratic formula.‬
‭79. Write a program to calculate the area of an ellipse (π × a × b).‬
‭80. Write a program to calculate the surface area of a cone (π × radius × (radius + slant height)).‬
‭81. Write a program to compute the volume of a rectangular prism.‬
‭82. Write a program to find the sum of cubes of the digits of a number.‬
‭83. Write a program to find the product of digits of a number.‬
‭84. Write a program to compute the harmonic sum of n terms.‬
‭85. Write a program to calculate the number of days between two dates.‬
‭86. Write a program to find the greatest common divisor (GCD) of two numbers.‬
‭87. Write a program to find the least common multiple (LCM) of two numbers.‬
‭88. Write a program to calculate the sum of the digits of a number recursively.‬
‭89. Write a program to calculate the sum of cubes of even numbers between 1 and n.‬
‭90. Write a program to calculate the sum of cubes of odd numbers between 1 and n.‬
‭91. Write a program to check if a number is prime and calculate its sum of digits.‬
‭92. Write a program to find the reverse of a given number.‬
‭93. Write a program to count how many times a digit appears in a given number.‬
‭94. Write a program to check if a number is an Armstrong number.‬
‭95. Write a program to calculate the average of the digits of a number.‬
‭96. Write a program to find the product of all even digits in a number.‬
‭97. Write a program to find the smallest prime factor of a number.‬
‭98. Write a program to find the sum of all prime numbers up to a given number.‬
‭99. Write a program to find the factorial of a number without using recursion.‬
‭100. Write a program to check if a number is a perfect square.‬

‭Using for loop:‬

‭ rint numbers from 1 to 100.‬


P
‭Print the first 10 even numbers.‬
‭Print the first 10 odd numbers.‬
‭Print multiplication table of a given number.‬
‭Find the sum of the first N natural numbers.‬
‭Find the factorial of a number.‬
‭Print the Fibonacci series up to N terms.‬
‭Print all prime numbers between 1 and N.‬
‭Print a pyramid of stars.‬
‭Check whether a given number is a palindrome or not.‬
‭Find the reverse of a number.‬
‭Count the number of digits in a given number.‬
‭Find the sum of digits of a number.‬
‭Print all the divisors of a given number.‬
‭Find the largest of N numbers.‬
‭Find the smallest of N numbers.‬
‭Check if a number is a perfect number.‬
‭Find the GCD of two numbers using a loop.‬
‭Find the LCM of two numbers using a loop.‬
‭Generate the first N terms of triangular numbers.‬
‭Generate a pattern of numbers in a square matrix (e.g., 1 2 3 4, 5 6 7 8, etc.).‬
‭Print the sum of the series: 1 + 1/2 + 1/3 + ... + 1/N.‬
‭Print all Armstrong numbers between 1 and N.‬
‭Print a Floyd’s triangle using numbers.‬
‭Print a Pascal's Triangle up to N rows.‬
‭Print all the perfect squares from 1 to N.‬
‭Check if a number is an Armstrong number.‬
‭Generate a pattern like a diamond with stars.‬
‭Sum of squares of first N natural numbers.‬
‭Sum of cubes of first N natural numbers.‬
‭ ind the sum of even numbers from 1 to N.‬
F
‭Find the sum of odd numbers from 1 to N.‬
‭Check if a number is a prime number.‬
‭Print reverse of a number without converting it to a string.‬
‭Find the sum of the first N prime numbers.‬
‭Check if a number is a strong number (sum of the factorial of digits equals the number).‬
‭Print all multiples of 3 and 5 below 100.‬
‭Print a number pattern like a right angle triangle with increasing numbers.‬
‭Print a number pattern like a diamond using numbers.‬
‭Print a hollow square pattern of stars.‬
‭Print a hollow triangle pattern of stars.‬
‭Print a pattern of numbers with alternating even/odd rows.‬
‭Print an inverted right-angle triangle of stars.‬
‭Print a pattern of numbers in a reverse triangle shape.‬
‭Calculate and print the product of first N numbers.‬
‭Check if a number is a perfect square.‬
‭Generate a pattern of even numbers in a triangle.‬
‭Print a checkerboard pattern using stars.‬
‭Sum of first N terms in the series of 1 + x + x^2 + x^3 + ...‬
‭Print a multiplication table for numbers from 1 to 10.‬

‭Using while loop:‬


‭ rint numbers from 1 to N using a while loop.‬
P
‭Find the factorial of a number using a while loop.‬
‭Find the sum of digits of a number using a while loop.‬
‭Check if a number is prime or not using a while loop.‬
‭Find the Fibonacci series up to N terms using a while loop.‬
‭Check whether a number is a palindrome or not using a while loop.‬
‭Find the reverse of a number using a while loop.‬
‭Sum of all even numbers between 1 and N using a while loop.‬
‭Sum of all odd numbers between 1 and N using a while loop.‬
‭Count the number of vowels in a string using a while loop.‬
‭Count the number of consonants in a string using a while loop.‬
‭Find the number of prime numbers between 1 and N using a while loop.‬
‭Calculate the sum of the series: 1 - 1/2 + 1/3 - 1/4 + ... up to N terms.‬
‭Print a pattern of stars in a right-angle triangle shape.‬
‭Count the number of digits in a number using a while loop.‬
‭ ind the first N Fibonacci numbers using a while loop.‬
F
‭Calculate the product of digits of a number using a while loop.‬
‭Check if a number is a perfect number using a while loop.‬
‭Generate a pattern like an inverted triangle using stars.‬
‭Calculate the sum of squares of first N natural numbers using a while loop.‬
‭Print all Armstrong numbers between 1 and N using a while loop.‬
‭Find the LCM of two numbers using a while loop.‬
‭Print the reverse of a string using a while loop.‬
‭Calculate the sum of squares of digits of a number using a while loop.‬
‭Print all the prime numbers less than N using a while loop.‬
‭Find the sum of the digits of a number raised to a power using a while loop.‬
‭Sum the first N odd numbers using a while loop.‬
‭Check if a number is a palindrome using a while loop.‬
‭Find the first N even numbers using a while loop.‬
‭Find the sum of the series: 1 + 1/2 + 1/3 + ... up to N terms using a while loop.‬

‭Using do...while loop:‬

‭ rint numbers from 1 to N using a do...while loop.‬


P
‭Find the factorial of a number using a do...while loop.‬
‭Sum the digits of a number using a do...while loop.‬
‭Check whether a number is prime using a do...while loop.‬
‭Print the Fibonacci series up to N terms using a do...while loop.‬
‭Check whether a number is a palindrome or not using a do...while loop.‬
‭Print a pattern of stars in a right-angle triangle shape using a do...while loop.‬
‭Calculate the sum of even numbers between 1 and N using a do...while loop.‬
‭Calculate the sum of odd numbers between 1 and N using a do...while loop.‬
‭Find the largest of N numbers using a do...while loop.‬
‭Calculate the LCM of two numbers using a do...while loop.‬
‭Print a series of numbers that form a palindrome sequence using a do...while loop.‬
‭Print numbers from 1 to 100 in reverse order using a do...while loop.‬
‭Print a pattern like a number pyramid using a do...while loop.‬
‭Find the product of digits of a number using a do...while loop.‬
‭Calculate the sum of squares of digits of a number using a do...while loop.‬
‭Print a triangular number pattern using a do...while loop.‬
‭Check if a number is a perfect number using a do...while loop.‬
‭Print Fibonacci numbers up to N terms using a do...while loop.‬
‭Sum the series: 1 + 1/2 + 1/3 + 1/4 + ... up to N terms using a do...while loop.‬

‭Using (If….else ; if….else-if ; nested if):‬


‭ . Check if a number is even or odd.‬
1
‭2. Check if a number is positive, negative, or zero.‬
‭3. Find the largest of two numbers.‬
‭4. Find the largest of three numbers.‬
‭5. Check if a year is a leap year.‬
‭6. Find the smallest of two numbers.‬
‭7. Find the largest of three numbers using `if...else-if`.‬
‭8. Check if a number is divisible by 5 and 10.‬
‭9. Check if a number is divisible by 3 but not 5.‬
‭10. Find the absolute value of a number.‬
‭11. Check whether a number is prime or not.‬
‭12. Find the factorial of a number.‬
‭13. Check if a number is a perfect number.‬
‭14. Find the sum of digits of a number.‬
‭15. Check if a number is an Armstrong number.‬
‭16. Check if a character is a vowel or consonant.‬
‭17. Check if a character is uppercase or lowercase.‬
‭18. Check if a character is a digit.‬
‭19. Check if a character is a special character.‬
‭20. Find the sum of the first `n` natural numbers.‬
‭21. Find the product of the first `n` even numbers.‬
‭22. Check if a triangle is valid based on the sides.‬
‭23. Find the area of a triangle using Heron's formula.‬
‭24. Find the area of a rectangle.‬
‭25. Find the perimeter of a rectangle.‬
‭26. Find the area of a circle.‬
‭27. Check if a number is a palindrome.‬
‭28. Find the reverse of a number.‬
‭29. Print all the prime numbers up to `n`.‬
‭30. Find the greatest common divisor (GCD) of two numbers.‬
‭31. Find the least common multiple (LCM) of two numbers.‬
‭32. Find the Fibonacci series up to `n`.‬
‭33. Calculate the power of a number.‬
‭ 4. Count the number of digits in a number.‬
3
‭35. Check if a string is a palindrome.‬
‭36. Find the length of a string without using `strlen()`.‬
‭37. Reverse a string.‬
‭38. Convert a string to uppercase.‬
‭39. Convert a string to lowercase.‬
‭40. Count the number of vowels in a string.‬
‭41. Count the number of consonants in a string.‬
‭42. Check if a number is a perfect square.‬
‭43. Check if a number is a power of two.‬
‭44. Check if a number is a Fibonacci number.‬
‭45. Check if a number is a prime palindrome.‬
‭46. Calculate the sum of squares of the first `n` natural numbers.‬
‭47. Check if two strings are anagrams.‬
‭48. Find the sum of two numbers without using arithmetic operators.‬
‭49. Swap two numbers without using a third variable.‬
‭50. Swap two numbers using a third variable.‬
‭51. Find the sum of digits of a number using recursion.‬
‭52. Calculate the factorial of a number using recursion.‬
‭53. Find the nth Fibonacci number using recursion.‬
‭54. Find the largest of three numbers using nested `if`.‬
‭55. Check if a number is a perfect number using recursion.‬
‭56. Find the reverse of a number using recursion.‬
‭57. Find the GCD of two numbers using recursion.‬
‭58. Find the LCM of two numbers using recursion.‬
‭59. Check if a number is divisible by both 7 and 11.‬
‭60. Count the number of even and odd digits in a number.‬
‭61. Check if a number is divisible by 2 or 3.‬
‭62. Check if a number is divisible by 4 but not 8.‬
‭63. Find the maximum of two numbers without using `if`.‬
‭64. Find the minimum of two numbers without using `if`.‬
‭65. Check if a year is a leap year using nested `if`.‬
‭66. Calculate the perimeter of a triangle using Heron's formula.‬
‭67. Check if a number is a strong number.‬
‭68. Check if a number is a palindrome using recursion.‬
‭69. Find the length of a string without using `strlen()`.‬
‭70. Reverse a string using recursion.‬
‭71. Convert a string to a number (string to integer).‬
‭72. Find the second largest number in an array.‬
‭73. Find the second smallest number in an array.‬
‭ 4. Find the average of `n` numbers.‬
7
‭75. Check if a string contains only digits.‬
‭76. Count the number of occurrences of a character in a string.‬
‭77. Find the sum of all elements in an array.‬
‭78. Find the largest element in an array.‬
‭79. Find the smallest element in an array.‬
‭80. Check if a number is a prime number using recursion.‬
‭81. Check if a number is divisible by 3, 5, or both.‬
‭82. Check if a string contains only alphabets.‬
‭83. Count the number of words in a string.‬
‭84. Convert a number to binary.‬
‭85. Convert a number to hexadecimal.‬
‭86. Convert a number to octal.‬
‭87. Check if a string contains a substring.‬
‭88. Find the longest word in a string.‬
‭89. Count the number of spaces in a string.‬
‭90. Find the first occurrence of a character in a string.‬
‭91. Find the last occurrence of a character in a string.‬
‭92. Replace all occurrences of a character in a string.‬
‭93. Count the number of even numbers in an array.‬
‭94. Count the number of odd numbers in an array.‬
‭95. Find the sum of positive numbers in an array.‬
‭96. Find the sum of negative numbers in an array.‬
‭97. Find the product of elements in an array.‬
‭98. Sort an array in ascending order.‬
‭99. Sort an array in descending order.‬
‭100. Check if an array is sorted in ascending order.‬

‭ 01.Find the sum of odd numbers in an array.‬


1
‭102.Find the product of digits of a number.‬
‭103. Count the number of vowels in a string using recursion.‬
‭104. Print a pyramid pattern using numbers.‬
‭105. Print a diamond pattern using stars.‬
‭106. Check if a number is divisible by both 2 and 5.‬
‭107. Check if a number is divisible by 10 but not by 5.‬
‭108. Find the sum of diagonal elements in a 2D array.‬
‭109. Count the number of words that start with a vowel in a string.‬
‭110. Find the frequency of each character in a string.‬
‭111. Find the longest palindrome substring in a string.‬
‭112. Find the smallest prime number greater than a given number.‬
‭ 13. Check if two numbers are co-prime (GCD = 1).‬
1
‭114. Check if a number is divisible by 6 or 7.‬
‭115. Find the sum of even digits of a number.‬
‭116. Find the sum of odd digits of a number.‬
‭117. Check if a string contains a substring using recursion.‬
‭118. Check if a number is divisible by 11 using `if...else-if`.‬
‭119. Count the number of uppercase letters in a string.‬
‭120. Count the number of lowercase letters in a string.‬
‭121. Check if a character is an alphabet using a nested `if`.‬
‭122. Find the longest word in a sentence using nested `if`.‬
‭123. Find the greatest element in a 2D array.‬
‭124. Find the sum of elements in a column of a 2D array.‬
‭125. Find the average of the diagonal elements in a matrix.‬
‭126. Check if two matrices are equal.‬
‭127. Find the transpose of a matrix.‬
‭128. Find the largest element in a row of a 2D array.‬
‭129. Check if a string contains a number.‬
‭130. Convert a string to a floating-point number.‬
‭131. Check if two strings are identical.‬
‭132. Find the sum of even numbers in a matrix.‬
‭133. Print a multiplication table of a number.‬
‭134. Find the maximum and minimum elements in a matrix.‬
‭135. Find the number of positive integers in an array.‬
‭136. Check if a number is a perfect cube.‬
‭137. Find the sum of first `n` odd numbers.‬
‭138. Check if a string contains only digits using `if`.‬
‭139. Count the number of words in a sentence using `if`.‬
‭140. Swap two numbers without using an extra variable.‬
‭141. Check if a number is a Fibonacci number using recursion.‬
‭142. Count the number of uppercase vowels in a string.‬
‭143. Print a right-angled triangle pattern using stars.‬
‭144. Find the LCM of three numbers using nested `if`.‬
‭145. Check if a character is a consonant or vowel using `nested if`.‬
‭146. Calculate the sum of squares of all elements in an array.‬
‭147. Find the number of digits in a floating-point number.‬
‭148. Find the sum of squares of even numbers in an array.‬
‭149. Find the sum of squares of odd numbers in an array.‬
‭150. Check if two numbers are divisible by 5 and 3.‬
‭151. Check if a number is divisible by 2 or 7.‬
‭152. Print a number pyramid pattern using a loop.‬
‭ 53. Check if a number is divisible by 12.‬
1
‭154. Print a reversed triangle pattern of numbers.‬
‭155. Find the sum of prime numbers in a given range.‬
‭156. Count the number of words in a sentence using recursion.‬
‭157. Check if a number is divisible by 3 or 7 but not by 5.‬
‭158. Print a checkerboard pattern using asterisks.‬
‭159. Find the factorial of a number using recursion.‬
‭160. Find the sum of even numbers in a range.‬
‭161. Print a number pyramid with spaces.‬
‭162. Check if a number is divisible by 2 but not by 3.‬
‭163. Print a square pattern of stars.‬
‭164. Check if a number is divisible by both 3 and 6.‬
‭165. Find the sum of digits in a string.‬
‭166. Check if a number is divisible by both 8 and 9.‬
‭167. Check if a number is divisible by 6 but not 9.‬
‭168. Check if a number is divisible by 15.‬
‭169. Print a pattern of numbers with each row increasing.‬
‭170. Print an inverted triangle of stars.‬
‭171. Find the sum of all odd numbers from `1` to `n`.‬
‭172. Check if a string contains a specific word.‬
‭173. Find the number of occurrences of a character in a sentence.‬
‭174. Check if a string starts with a vowel.‬
‭175. Print an equilateral triangle using stars.‬
‭176. Check if a string ends with a specific character.‬
‭177. Print a pattern of squares of numbers.‬
‭178. Find the sum of first `n` prime numbers.‬
‭179. Print a pattern of numbers forming a square.‬
‭180. Check if a number is divisible by 10 or 20.‬
‭181. Check if a string has more vowels than consonants.‬
‭182. Check if a number is divisible by both 5 and 7.‬
‭183. Find the largest number in a matrix.‬
‭184. Check if a number is divisible by 2 or 4 but not by 6.‬
‭185. Count the total number of words in a string.‬
‭186. Find the smallest prime number larger than `n`.‬
‭187. Check if a number is divisible by 12 or 20.‬
‭188. Find the sum of even numbers divisible by 4 in an array.‬
‭189. Check if a number is divisible by 5 or 10 but not both.‬
‭190. Print a pattern of diamonds using stars.‬
‭191. Print a pattern of numbers decreasing in each row.‬
‭192. Find the first `n` Fibonacci numbers.‬
‭ 93. Find the reverse of a string without using string functions.‬
1
‭194. Print an inverted number pyramid.‬
‭195. Check if a number is divisible by 6 but not 9 using nested if.‬
‭196. Find the square of each number in an array.‬
‭197. Count the number of odd elements in a matrix.‬
‭198. Find the second smallest number in a list of numbers.‬
‭199. Find the sum of digits of a number using recursion.‬
‭200. Print a multiplication table up to `n` numbers.‬

‭using ( switch , break and continue statement):‬

‭ . Simple calculator using switch‬


1
‭2. Check which day of the week it is using a number (1-7)‬
‭3. Print the month name based on a number (1-12)‬
‭4. Determine the grade of a student based on marks using switch‬
‭5. Menu-driven program for basic arithmetic operations‬
‭6. Determine the season of the year based on month number‬
‭7. Convert lowercase letters to uppercase and vice versa using switch‬
‭8. Check the type of triangle based on the lengths of three sides‬
‭9. Print the name of a day given its number (1 to 7) using a switch‬
‭10. Find the largest of three numbers using switch‬
‭11. Calculate the factorial of a number using switch-case (choose operation)‬
‭12. Convert a number into its equivalent Roman numeral using switch‬
‭13. Determine whether a character is vowel or consonant using switch‬
‭14. Display the number of days in a month based on month number using switch‬
‭15. Check if a number is divisible by 2, 3, or 5 using switch‬
‭16. Find the sum of the first n natural numbers using switch-case‬
‭17. Print even or odd numbers from 1 to n using continue‬
‭18. Display the multiplication table of a number using switch‬
‭19. Check if a number is prime using switch-case‬
‭20. Find the even or odd number of digits in a given number using switch‬
‭21. Simple program to display "Hello World" with a menu selection using switch‬
‭22. Check if a number is positive, negative, or zero using switch‬
‭23. Find the square of a number using switch-case‬
‭24. Check if a year is a leap year using switch‬
‭25. Print the ASCII value of a character using switch‬
‭ 6. Print reverse of a number using switch-case‬
2
‭27. Check if a number is an Armstrong number using switch‬
‭28. Print the first 10 Fibonacci numbers using switch‬
‭29. Find the GCD of two numbers using switch‬
‭30. Print a pattern of stars using a menu-driven program‬
‭31. Count the number of digits in a number using switch‬
‭32. Check if a string contains only digits using switch‬
‭33. Print the Fibonacci sequence up to n terms using switch‬
‭34. Check if a number is a palindrome using switch‬
‭35. Convert a number from decimal to binary using switch‬
‭36. Check if a character is an alphabet using switch‬
‭37. Check if a number is a perfect number using switch‬
‭38. Find the sum of natural numbers using switch‬
‭39. Check if a number is a perfect square using switch-case‬
‭40. Determine the largest of three numbers using switch-case‬
‭41. Check if a number is divisible by 7 using continue‬
‭42. Print all prime numbers up to n using switch‬
‭43. Check if a string is a palindrome using switch‬
‭44. Calculate the factorial of a number using switch and continue‬
‭45. Print numbers 1 to 100 except multiples of 3 using continue‬
‭46. Find the ASCII value of a character using switch‬
‭47. Display numbers divisible by 5 and 3 between 1 and n using continue‬
‭48. Find the sum of squares of numbers from 1 to n using switch‬
‭49. Count the vowels in a string using switch‬
‭50. Find the sum of even numbers from 1 to n using switch‬
‭51. Find the sum of odd numbers from 1 to n using switch‬
‭52. Print the sum of the digits of a number using switch‬
‭53. Check if a number is a perfect number using continue‬
‭54. Determine if a number is a prime using switch‬
‭55. Sum of squares of numbers in a given range using switch‬
‭56. Print numbers that are divisible by both 5 and 7 using continue‬
‭57. Find the smallest prime number larger than n using switch‬
‭58. Print all prime numbers between two numbers using switch‬
‭59. Find the sum of elements in an array using switch‬
‭60. Print multiplication table of a given number using switch‬
‭61. Check if a string contains vowels using switch‬
‭62. Print numbers between 1 to n that are divisible by 2 or 3 using continue‬
‭63. Print numbers between 1 to n that are divisible by neither 2 nor 3 using continue‬
‭64. Print numbers from 1 to 100 except multiples of 5 using continue‬
‭65. Print numbers divisible by 4 but not by 8 using continue‬
‭ 6. Display a simple menu with options using switch-case‬
6
‭67. Calculate the sum of the digits of a number using continue‬
‭68. Check if a number is divisible by 2 or 5 using continue‬
‭69. Count the number of prime numbers in an array using switch‬
‭70. Print the factorial of a number using switch and continue‬
‭71. Find the largest of three numbers using switch‬
‭72. Check if a number is a perfect cube using switch‬
‭73. Display numbers from 1 to 50 excluding multiples of 4 using continue‬
‭74. Check if a string contains special characters using switch‬
‭75. Convert a number to binary using switch‬
‭76. Find the reverse of a number using switch and continue‬
‭77. Check if a number is divisible by 6 but not by 9 using switch‬
‭78. Find the sum of even digits in a number using switch‬
‭79. Find the sum of odd digits in a number using switch‬
‭80. Print all the odd numbers in an array using switch‬
‭81. Find the second largest number in an array using switch‬
‭82. Find the second smallest number in an array using switch‬
‭83. Print a pattern of stars in the form of a triangle using switch‬
‭84. Check if a number is divisible by 8 or 9 using continue‬
‭85. Check if a character is a digit using switch‬
‭86. Check if a character is uppercase or lowercase using switch‬
‭87. Find the number of occurrences of a character in a string using switch‬
‭88. Print the largest element in an array using switch‬
‭89. Print the smallest element in an array using switch‬
‭90. Count the total number of digits in a string using switch‬
‭91. Print a pattern of numbers in increasing order using switch‬
‭92. Find the LCM of two numbers using switch‬
‭93. Find the GCD of two numbers using switch‬
‭94. Find the average of all elements in an array using switch‬
‭95. Find the sum of positive numbers in an array using switch‬
‭96. Find the sum of negative numbers in an array using switch‬
‭97. Display the first n Fibonacci numbers using switch‬
‭98. Check if a string contains only numbers using switch‬
‭99. Print the reverse of a string using switch‬
‭100. Print a pattern of stars forming a pyramid shape using switch‬
*‭ **Introduction to functions (function definitions, function prototypes and‬
‭argument, header files). Solving complex problems in modular fashion using‬
‭user defined function 😀‬

‭ . Write a function to find the factorial of a number.‬


1
‭2. Write a function to check if a number is prime.‬
‭3. Write a function to find the greatest of three numbers.‬
‭4. Write a function to calculate the area of a circle.‬
‭5. Write a function to calculate the perimeter of a rectangle.‬
‭6. Write a function to calculate the sum of the first n natural numbers.‬
‭7. Write a function to reverse a given integer number.‬
‭8. Write a function to check if a number is a palindrome.‬
‭9. Write a function to calculate the sum of digits of a number.‬
‭10. Write a function to calculate the power of a number (x^n).‬
‭11. Write a function to find the Fibonacci series up to n terms.‬
‭12. Write a function to find whether a given year is a leap year.‬
‭13. Write a function to convert temperature from Celsius to Fahrenheit.‬
‭14. Write a function to calculate the area of a triangle using Heron’s formula.‬
‭15. Write a function to find the average of an array of numbers.‬
‭16. Write a function to find the length of a string without using strlen().‬
‭17. Write a function to check if a string is a palindrome.‬
‭18. Write a function to find the maximum and minimum elements in an array.‬
‭19. Write a function to count the number of vowels in a string.‬
‭20. Write a function to find the middle element of an array.‬
‭21. Write a function to swap two numbers without using a third variable.‬
‭22. Write a function to calculate the sum of the squares of the first n numbers.‬
‭23. Write a function to calculate the area and perimeter of a rectangle.‬
‭24. Write a function to check if a number is even or odd.‬
‭25. Write a function to remove spaces from a string.‬
‭26. Write a function to find the largest number in an array.‬
‭27. Write a function to reverse a string.‬
‭28. Write a function to find the second largest number in an array.‬
‭29. Write a function to convert binary to decimal.‬
‭30. Write a function to convert decimal to binary.‬
‭31. Write a function to check if a character is a digit.‬
‭32. Write a function to find the sum of elements in an array.‬
‭33. Write a function to calculate the sum of the first n odd numbers.‬
‭34. Write a function to calculate the sum of the first n even numbers.‬
‭ 5. Write a function to sort an array of integers.‬
3
‭36. Write a function to find the largest prime factor of a number.‬
‭37. Write a function to count the number of words in a string.‬
‭38. Write a function to find the highest common factor (HCF) of two numbers.‬
‭39. Write a function to find the least common multiple (LCM) of two numbers.‬
‭40. Write a function to merge two sorted arrays into one sorted array.‬
‭41. Write a function to find the factorial of a number using recursion.‬
‭42. Write a function to check if a number is a perfect number.‬
‭43. Write a function to check if a number is an Armstrong number.‬
‭44. Write a function to compute the nth Fibonacci number using recursion.‬
‭45. Write a function to compute the power of a number using recursion.‬
‭46. Write a function to count the number of consonants in a string.‬
‭47. Write a function to find the common elements in two arrays.‬
‭48. Write a function to generate the Fibonacci series using iteration.‬
‭49. Write a function to print a multiplication table of n.‬
‭50. Write a function to print the reverse of an array.‬
‭51. Write a function to print a pattern of stars forming a right-angled triangle.‬
‭52. Write a function to calculate the simple interest.‬
‭53. Write a function to calculate the compound interest.‬
‭54. Write a function to check if a number is a perfect square.‬
‭55. Write a function to remove all occurrences of a given character from a string.‬
‭56. Write a function to count the number of occurrences of a character in a string.‬
‭57. Write a function to count the number of digits in a given number.‬
‭58. Write a function to reverse the digits of a number.‬
‭59. Write a function to print a pyramid of stars.‬
‭60. Write a function to find the ASCII value of a character.‬
‭61. Write a function to print the factors of a number.‬
‭62. Write a function to find the maximum number in a list of numbers.‬
‭63. Write a function to find the minimum number in a list of numbers.‬
‭64. Write a function to check if a string contains only digits.‬
‭65. Write a function to find the sum of squares of the digits of a number.‬
‭66. Write a function to print an inverted right triangle pattern of stars.‬
‭67. Write a function to find the sum of elements divisible by k in an array.‬
‭68. Write a function to check if a string is an anagram of another string.‬
‭69. Write a function to print a hollow rectangle pattern of stars.‬
‭70. Write a function to find the intersection of two arrays.‬
‭71. Write a function to calculate the area and perimeter of a circle.‬
‭72. Write a function to determine if a number is a strong number.‬
‭73. Write a function to print all prime numbers up to n.‬
‭74. Write a function to find the mode of a set of numbers.‬
‭ 5. Write a function to check if a string is a valid number.‬
7
‭76. Write a function to find the largest element in a 2D array.‬
‭77. Write a function to find the smallest element in a 2D array.‬
‭78. Write a function to print a square pattern of stars.‬
‭79. Write a function to implement the strlen() function without using the standard library function.‬
‭80. Write a function to remove duplicate elements from an array.‬
‭81. Write a function to check if a number is a perfect cube.‬
‭82. Write a function to calculate the geometric mean of a set of numbers.‬
‭83. Write a function to print a diamond-shaped pattern of stars.‬
‭84. Write a function to find the square root of a number using the Newton-Raphson method.‬
‭85. Write a function to find the nth largest element in an array.‬
‭86. Write a function to find the sum of the first n prime numbers.‬
‭87. Write a function to print an alternating pattern of stars.‬
‭88. Write a function to find the length of a string using recursion.‬
‭89. Write a function to print a hollow diamond pattern of stars.‬
‭90. Write a function to check if a string contains all unique characters.‬
‭91. Write a function to sort an array of strings in alphabetical order.‬
‭92. Write a function to generate a random number within a given range.‬
‭93. Write a function to find the number of days between two dates.‬
‭94. Write a function to convert a string to uppercase.‬
‭95. Write a function to convert a string to lowercase.‬
‭96. Write a function to count the number of uppercase and lowercase characters in a string.‬
‭97. Write a function to find the highest and lowest element in a matrix.‬
‭98. Write a function to perform matrix multiplication.‬
‭99. Write a function to find the sum of odd indexed elements in an array.‬
‭100. Write a function to implement the binary search algorithm.‬

‭Basic Array Operations:‬

‭ eclare an array of 10 integers and initialize it with values.‬


D
‭Write a program to print all elements of a 1D array.‬
‭Write a program to find the sum of all elements in an array.‬
‭Write a program to find the average of all elements in an array.‬
‭Write a program to find the maximum element in an array.‬
‭Write a program to find the minimum element in an array.‬
‭Write a program to find the second largest element in an array.‬
‭ rite a program to count how many times a number appears in an array.‬
W
‭Write a program to reverse an array of integers.‬
‭Write a program to check whether an array is sorted in ascending order.‬
‭Write a program to check whether an array is sorted in descending order.‬
‭Write a program to remove duplicates from an array.‬
‭Write a program to insert an element at a specific index in an array.‬
‭Write a program to delete an element from an array by shifting the remaining elements.‬
‭Write a program to rotate an array to the left by n positions.‬
‭Write a program to rotate an array to the right by n positions.‬
‭Write a program to merge two sorted arrays into a single sorted array.‬
‭Write a program to find the sum of two arrays element by element.‬
‭Write a program to sort an array in ascending order using the bubble sort algorithm.‬
‭Write a program to sort an array in descending order using the bubble sort algorithm.‬
‭Write a program to perform binary search on a sorted array.‬
‭Write a program to find the frequency of each element in an array.‬
‭Write a program to reverse the elements of a 2D array.‬
‭Write a program to find the largest and smallest number in a 2D array.‬
‭Write a program to find the sum of all the elements in a 2D array.‬

‭Array Manipulation with Functions‬

‭ rite a function to find the largest element in an array.‬


W
‭Write a function to find the smallest element in an array.‬
‭Write a function to find the average of the elements in an array.‬
‭Write a function to count the number of even numbers in an array.‬
‭Write a function to count the number of odd numbers in an array.‬
‭Write a function to find the sum of the elements of an array.‬
‭Write a function to reverse an array.‬
‭Write a function to merge two arrays into one.‬
‭Write a function to check whether a number is present in an array.‬
‭Write a function to search for an element in a sorted array using binary search.‬
‭Write a function to find the index of the maximum element in an array.‬
‭Write a function to find the index of the minimum element in an array.‬
‭Write a function to check if an array is a palindrome.‬
‭Write a function to find the common elements between two arrays.‬
‭Write a function to remove all occurrences of a given element from an array.‬
‭Write a function to find the intersection of two arrays.‬
‭Write a function to find the union of two arrays.‬
‭Write a function to merge two arrays and remove duplicates.‬
‭ rite a function to calculate the product of all elements in an array.‬
W
‭Write a function to find the difference between the highest and lowest values in an array.‬
‭Write a function to find if two arrays are equal (contain the same elements in the same order).‬
‭Write a function to check if one array is a subarray of another array.‬
‭Write a function to left shift the elements of an array.‬
‭Write a function to right shift the elements of an array.‬
‭Write a function to find the median of a sorted array.‬

‭Multidimensional Arrays‬

‭ rite a program to declare and initialize a 2D array with 3 rows and 3 columns.‬
W
‭Write a program to print a 2D array.‬
‭Write a program to find the sum of all elements in a 2D array.‬
‭Write a program to find the largest element in a 2D array.‬
‭Write a program to find the smallest element in a 2D array.‬
‭Write a program to find the sum of each row in a 2D array.‬
‭Write a program to find the sum of each column in a 2D array.‬
‭Write a program to find the transpose of a 2D array.‬
‭Write a program to check if two 2D arrays are equal.‬
‭Write a program to multiply two matrices (2D arrays).‬
‭Write a program to add two matrices (2D arrays).‬
‭Write a program to perform matrix subtraction (2D arrays).‬
‭Write a program to rotate a matrix 90 degrees clockwise.‬
‭Write a program to rotate a matrix 90 degrees counterclockwise.‬
‭Write a program to print a matrix in spiral order.‬
‭Write a program to find the trace of a square matrix.‬
‭Write a program to find the determinant of a 2x2 matrix.‬
‭Write a program to check if a 2D array is symmetric (i.e., equal to its transpose).‬
‭Write a program to calculate the row-wise sum and column-wise sum of a 2D array.‬
‭Write a program to search for an element in a 2D array.‬
‭Advanced Array Operations:‬

‭ rite a program to implement the insertion sort algorithm on an array.‬


W
‭Write a program to implement the selection sort algorithm on an array.‬
‭Write a program to implement the merge sort algorithm on an array.‬
‭Write a program to implement the quicksort algorithm on an array.‬
‭Write a program to implement the heap sort algorithm on an array.‬
‭Write a program to perform matrix multiplication (2D arrays) using dynamic memory allocation.‬
‭Write a program to dynamically allocate memory for a 2D array.‬
‭Write a program to find the longest increasing subsequence in an array.‬
‭Write a program to find the longest decreasing subsequence in an array.‬
‭Write a program to rotate an array by k positions using an optimized approach.‬
‭Write a program to count the number of inversions in an array.‬
‭Write a program to find the kth largest element in an array.‬
‭Write a program to find the kth smallest element in an array.‬
‭Write a program to find the pair with the maximum sum in an array.‬
‭Write a program to find the pair with the minimum difference in an array.‬
‭Write a program to find the subarray with the maximum sum (Kadane's algorithm).‬
‭Write a program to find the longest common subsequence in two arrays.‬
‭Write a program to find the longest common substring in two arrays.‬
‭Write a program to check if an array is a subset of another array.‬
‭Write a program to find the number of unique pairs whose sum is equal to a given target value.‬
‭Write a program to find the intersection of two arrays using hash maps.‬
‭Write a program to find the union of two arrays using hash maps.‬
‭Write a program to implement the "find and union" operation on arrays using disjoint sets.‬
‭Write a program to perform a quickselect algorithm to find the kth smallest/largest element in an‬
‭array.‬
‭Write a program to check if an array contains a subarray with a given sum.‬
‭Write a program to rearrange the elements of an array such that all even elements come before odd‬
‭elements.‬
‭Write a program to sort an array of strings based on their lengths.‬
‭Write a program to implement the Fisher-Yates shuffle to shuffle an array.‬
‭Write a program to find the peak element in an array.‬
‭Write a program to implement a dynamic array (resizing array) using pointers and memory‬
‭allocation.‬

You might also like