Home

A program to explain FUNCTION WITH ARGUMENTS and RETURN VALUES

C Programming Language 078

Program

#include <stdio.h>

int sum(int, int);

void main()
{
    int a, b, c;
    printf("Enter two numbers: ");
    scanf("%d %d", &a, &b);

    c = sum(a, b);
    printf("Sum = %d", c);
    printf("\n");
}

int sum(int x, int y)
{
    return x + y;
}

Result

Enter two numbers: 4 5
Sum = 9


Last Updated on

Next Post: Rules vs Guidelines →

Comments