Home

A program to explain FUNCTION WITH ARGUMENTS and WITHOUT RETURN VALUES

C Programming Language 076

Program

#include <stdio.h>

void sum(int x, int y);

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

void sum(int x, int y)
{
    int z;

    z = x + y;
    printf("Sum = %d", z);
}

Result

Enter two numbers: 4 5
Sum = 9


Last Updated on

Next Post: Rules vs Guidelines →

Comments