Home

A program to explain FUNCTION WITHOUT ARGUMENTS and WITH RETURN VALUES

C Programming Language 077

Program

#include <stdio.h>

int sum();

void main()
{
    int c;
    c = sum();
    printf("Sum = %d", c);
    printf("\n");
}

int sum()
{

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

    return a + b;
}

Result

Enter two numbers: 4 5
Sum = 9


Last Updated on

Next Post: Rules vs Guidelines →

Comments