C Program for function with argument and no return value


In this program, You will learn how to create a function with argument and no return value in c.


void sum(int x, int y) {
    //statement
 }

Example: How to create a function with argument and no return value in c.

#include<stdio.h>

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

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

int main() {

   int x, y, s;

   printf("Enter two numbers:");
   scanf("%d%d", &x, &y);

   sum(x, y);

   return 0;
}

Output:

Enter two numbers:10 20                                                                                                                
Sum is:30