Programming

Function Passing No Arguments and Returning Values

This program describes how to write function passing no arguments and returning values.

#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

Tuts

About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.