Practice Top 30 C Programming Questions on Inline Function
Q1. Write an inline function to calculate the square of a number.
Input: 4
Output: Square = 16
Q2. Write an inline function to find the maximum of two numbers.
Input: 5, 8
Output: Maximum = 8
Q3. Write an inline function to calculate the cube of a number.
Input: 3
Output: Cube = 27
Q4. Write an inline function to add two numbers.
Input: 7, 5
Output: Sum = 12
Q5. Write an inline function to check if a number is even or odd.
Input: 9
Output: Odd
Q6. Write an inline function to calculate the area of a circle.
Input: Radius = 5
Output: Area = 78.54
Q7. Write an inline function to calculate the perimeter of a rectangle.
Input: Length = 6, Width = 4
Output: Perimeter = 20
Q8. Write an inline function to multiply two numbers.
Input: 4, 7
Output: Product = 28
Q9. Write an inline function to calculate simple interest.
Input: Principal = 1000, Rate = 5, Time = 2
Output: Simple Interest = 100
Q10. Write an inline function to check if a year is a leap year.
Input: 2000
Output: Leap Year
Q11. Write an inline function to find the minimum of two numbers.
Input: 9, 3
Output: Minimum = 3
Q12. Write an inline function to calculate the average of two numbers.
Input: 10, 20
Output: Average = 15
Q13. Write an inline function to convert a temperature from Celsius to Fahrenheit.
Input: 25
Output: 77°F
Q14. Write an inline function to convert a temperature from Fahrenheit to Celsius.
Input: 68
Output: 20°C
Q15. Write an inline function to calculate the area of a rectangle.
Input: Length = 8, Width = 5
Output: Area = 40
Q16. Write an inline function to calculate the percentage of marks.
Input: Marks = 450, Total = 500
Output: Percentage = 90%
Q17. Write an inline function to check if a number is positive or negative.
Input: -7
Output: Negative
Q18. Write an inline function to swap two numbers.
Input: a = 5, b = 10
Output: a = 10, b = 5
Q19. Write an inline function to find the modulus of two numbers.
Input: 9, 4
Output: Modulus = 1
Q20. Write an inline function to calculate the area of a triangle.
Input: Base = 5, Height = 4
Output: Area = 10
Q21. Write an inline function to calculate \( a^b \).
Input: a = 2, b = 3
Output: Power = 8
Q22. Write an inline function to find the maximum of three numbers.
Input: 4, 7, 2
Output: Maximum = 7
Q23. Write an inline function to calculate compound interest.
Input: Principal = 1000, Rate = 5, Time = 2
Output: Compound Interest = 102.50
Q24. Write an inline function to check if a number is divisible by another.
Input: 15, 5
Output: Divisible
Q25. Write an inline function to calculate the hypotenuse of a right triangle.
Input: a = 3, b = 4
Output: Hypotenuse = 5
Q26. Write an inline function to convert kilometers to miles.
Input: 10
Output: 6.21 miles
Q27. Write an inline function to find the square root of a number.
Input: 16
Output: 4
Q28. Write an inline function to check if a character is an uppercase letter.
Input: 'A'
Output: Uppercase
Q29. Write an inline function to calculate the hypotenuse using the Pythagorean theorem.
Input: 3, 4
Output: 5
Q30. Write an inline function to convert a character from lowercase to uppercase.
Input: 'b'
Output: 'B'
Bikki Singh
Hi, I am the instructor of TechnoVlogs. I have a strong love for programming and enjoy teaching through practical examples. I made this site to help people improve their coding skills by solving real-world problems. With years of experience, my goal is to make learning programming easy and fun for everyone. Let's learn and grow together!