June 8, 2023
Program to use function find the sum of two numbers
#include <stdio.h>
int sum(int x, int y);
int main(void)
{
int a = 10, b = 20, k;
k = sum(a, b); /*Function call*/
printf("%d\n", k);
k = sum(4, 5); /*Function call*/
printf("%d\n", k);
k = sum(a + b, b * 2); /*function call*/
printf("%d\n", k);
return 0;
}
int sum(int x, int y)
{
int s;
s = x + y;
return s;
}
Output
30
9
70
by : Nadeem Khan
Quick Summary:
Program to use function find the sum of two numbers copy #include <stdio.h> int sum(int x, int y); int main(void) { int a = 10, b = 20, k; k = sum(a, b); /*Function call*/ printf(“%d\n”, k); k = sum(4, 5); /*Function call*/ printf(“%d\n”, k); k = sum(a + b, b * 2); /*function call*/ […]