CS Electrical And Electronics
@cselectricalandelectronics

Addition of two numbers in C using functions?

All QuestionsCategory: C LanguageAddition of two numbers in C using functions?
CS Electrical And Electronics Staff asked 3 years ago

I need short information.

1 Answers
CS Electrical And Electronics Staff answered 3 years ago
#include<stdio.h>

int main() {
int num1, num2, res;

printf("\nEnter the two numbers : ");
scanf("%d %d", &num1, &num2);

//Call Function
res = sum(num1, num2);

printf("Addition of two number is : %d ",res);
return (0);
}

int sum(int num1, int num2) {
int num3;
num3 = num1 + num2;
return (num3);
}