Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Implement a program to perform basic arithmetic operations on two numbers using function pointers.

Hard

Problem Statement

Implement a program to perform basic arithmetic operations on two numbers using function pointers.

Sample Input

a = 10, b = 5

Sample Output

Sum = 15
Difference = 5
Product = 50
Quotient = 2

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
#include <stdio.h> typedef int (*operation)(int, int); int add(int a, int b); int subtract(int a, int b); int multiply(int a, int b); int divide(int a, int b); int main() { int a = 10, b = 5; // Logic to perform operations using function pointers return 0; }
Log in or sign up to run or submit your code.Log inSign up
Input
a = 10, b = 5
Expected Output
Sum = 15
Difference = 5
Product = 50
Quotient = 2