Implement a program to perform basic arithmetic operations on two numbers using function pointers.
HardProblem 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;
}
Input
a = 10, b = 5
Expected Output
Sum = 15 Difference = 5 Product = 50 Quotient = 2