/*
Name : C source program for summation subtraction multiplication and division using function
Author : Funny Coder(Maniruzzman Akash)
It's a free code. You can use it anywhere
*/
int sum(int num1, int num2);
int sub(int num1, int num2);
int mul(int num1, int num2);
int div(int num1, int num2);
#include<stdio.h>
int main(){
int num1, num2, option;
printf("\nEnter first number : ");
scanf("%d", &num1);
printf("\nEnter second number : ");
scanf("%d", &num2);
printf("Which execution do you want to : ");
printf("\nPress 1 for sum, 2 for sub, 3 for multiplication and 4 for division : ");
scanf("%d", &option);
if(option == 1){
printf("Summation is : %d\n", sum(num1, num2));
}else if(option == 2){
printf("Subtraction is : %d\n", sub(num1, num2));
}else if(option == 3){
printf("Multiplication is : %d\n", mul(num1, num2));
}else if(option == 4){
printf("Division is : %d\n", div(num1, num2));
}else{
printf("Invalid Option ..!!\n");
}
return 0;
}
int sum(int num1, int num2){
int result;
result = num1 + num2;
return result;
}
int sub(int num1, int num2){
int result;
result = num1 - num2;
return result;
}
int mul(int num1, int num2){
int result;
result = num1 * num2;
return result;
}
int div(int num1, int num2){
int result;
result = num1 / num2;
return result;
}
No comments:
Post a Comment