Function Passing no Arguments and Returning Values

Function Passing no Arguments and Returning Values, Write a program to demonstrate function passing no arguments and returning values.

Write a program to demonstrate function passing no arguments and returning values.

Write a c program for function passing no arguments and returning values.

C Code


#include <stdio.h>
#include <conio.h>

int sum (void);

void main()
{
  int c;
  c=sum();
  printf("\n The sum of two numbers is : %d",c);
  getch();
}
int sum(void){
  int add, a, b;

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

  add=a+b;

  return(add);
}

Output

Function Passing no Arguments and Returning Values


You May Also Like...

Socialize with Us