Variable Initialization:
You are writing a program that takes the temperature of a city in Celsius and converts it to
Fahrenheit. What variables would you use, and how would you implement the conversion
formula?
Array Operations:
You are given an array of integers. Write a C program to find the largest and smallest
numbers in the array. How would you go about doing this efficiently?
String Manipulation:
Write a C program that takes a sentence as input and counts the number of vowels in it. How
would you approach this problem using loops and conditionals?
Prime Number Check:
You are asked to write a function that checks if a given number is prime or not. How would
you implement this function?
Swap Two Numbers:
You are given two numbers and need to swap their values without using a third variable.
How can you accomplish this in C?
Matrix Multiplication:
You are given two 2x2 matrices, and you need to multiply them. Write a C program to
perform this operation.
Factorial Calculation (Iterative vs Recursive):
You need to calculate the factorial of a number both iteratively and recursively. How would
you implement both methods in C?
Palindrome Check:
Write a C program that checks if a given string is a palindrome or not (a word that reads the
same backward as forward). How would you do this?
Reverse an Array:
You are given an array of integers. Write a C program to reverse the array. What would be
the most efficient way to implement this?
Count Digits in a Number:
Write a C program that counts how many digits a number has. For example, for the input
12345, the output should be 5. How would you solve this?
Fibonacci Series (Using Loops):
You are asked to print the Fibonacci sequence up to a certain number n. How would you
implement this using a for loop?
Temperature Conversion (Multiple Inputs):
Write a C program that converts a list of temperatures from Celsius to Fahrenheit. How
would you handle the multiple inputs and conversions in your code?
Simple Calculator:
You are writing a simple calculator program that supports addition, subtraction,
multiplication, and division. How would you implement this using a switch statement in C?
Find GCD of Two Numbers (Euclidean Algorithm):
You are asked to find the greatest common divisor (GCD) of two numbers. How would you
implement this using the Euclidean algorithm?
Duplicate Elements in Array:
You are given an array with some duplicate elements. Write a C program to print all the
duplicate elements in the array.
Dynamic Memory Allocation:
Write a C program that dynamically allocates memory for an array of integers based on user
input, then fills the array with values and prints them.
Sum of Digits in a Number:
You are given a number and need to find the sum of its digits. For example, for the number
1234, the sum would be 1+2+3+4 = 10. How would you solve this?
Sum of Even and Odd Numbers in Array:
You are given an array of integers. Write a C program to find the sum of even numbers and
the sum of odd numbers in the array.
Find Missing Number in Array:
You are given an array containing numbers from 1 to n, but one number is missing. Write a C
program to find the missing number in the array.
Reverse a String:
Write a C program to reverse a string entered by the user. For example, for the input "Hello",
the output should be "olleH".
Check Even or Odd Number:
You are given a number and need to check if it is even or odd. How would you implement
this in C?
Sum of Prime Numbers in a Range:
Write a C program that calculates the sum of all prime numbers between two given numbers
a and b.
Sum of N Natural Numbers (Using Formula):
Write a C program to calculate the sum of the first n natural numbers using the formula
n*(n+1)/2.
Count Occurrences of a Character in a String:
You are asked to write a C program to count how many times a specific character appears in
a string.
Create a Simple Menu-Driven Program:
You need to write a menu-driven C program that allows the user to choose from different
options, such as calculating the factorial, checking whether a number is prime, etc.
Sum of Diagonal Elements in a Matrix:
You are given a 3x3 matrix. Write a C program to calculate the sum of the diagonal elements
(both main and secondary diagonals).
Find the Length of a String:
Write a C program to find the length of a string without using the strlen() function.
Sort an Array in Ascending Order:
You are given an array of integers. Write a C program to sort the array in ascending order
using the bubble sort algorithm.
Find the Second Largest Element in an Array:
You are given an array of integers. Write a C program to find the second-largest element in
the array.
Create a Simple Calculator Using Functions:
Write a C program that uses separate functions for addition, subtraction, multiplication, and
division. The user should be able to select an operation from the menu.