- Get link
- X
- Other Apps
Featured Post
Write a C program to calculate the sum of two number using function | Functions in C | C programing examples
- Get link
- X
- Other Apps
Write a C program to calculate the sum of two number using function | Functions in C | C programing examples
C program : sum of two numbers using a function:
#include <stdio.h>
// Function declaration
int add(int a, int b);
int main()
{
int num1, num2, result;
// Input two numbers
printf("Enter the first number: ");
scanf("%d", &num1);
printf("Enter the second number: ");
scanf("%d", &num2);
// Call the function to add the numbers
result = add(num1, num2);
// Display the result
printf("The sum of %d and %d is: %d\n", num1, num2, result);
return 0;
}
// Function definition
int add(int a, int b)
{
return a + b;
}
More Links:
- Get link
- X
- Other Apps
