Function Passing no Arguments and Returning Values

0
1
digitalample eye

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here