C program to perform arithmetic operation using function

In this program, we will implement basic arithmetic operations using functions. We will use function dedicated to calculate the required arithmetic operation and we will call that function when we want to perform particular mathematic operation.

Pre-requisites:

Functions, input output functions, variables, data types

Approach:

We will take input from user and then pass that value to arithmetic function we have defined in our program. After that function will do expression evaluation and then will return output or we can print output in that function only.

Step by step procedure:

Declare a function above main method with proper prototype.
Let’s take two input values from user through command prompt and store it in variable. E.g. input = 5, 6
Make function call and then pass arguments
Store results returned by function into variable or directly print output from function itself.

Program:

Output:

1 thought on “C program to perform arithmetic operation using function”

Leave a Reply

%d bloggers like this: