Computer Programming C Laboratory: Functions C Programs

C Program to print addition, subtraction and multiplication values using functions (Function with no arguments and no return values)

Function with no arguments and no return values - C Programming

Function with no arguments and no return values

C Program to print addition, subtraction and multiplication values using functions.

/* Program to print addition, subtraction and multiplication values */

#include <stdio.h>

#include <conio.h>

void main()

{

void add(), sub(), mul(); /*Local definitions */

/* Statements */

clrscr();

add(); /*function call */

sub(); /* function call */

mul(); /*function call */

} /*main */

void add()

{

int a=10,b=5;

printf("The addition value is: %d\n", a+b);

} /*add */

void sub()

{

int a=10,b=5;

printf("The subtract value is : %d\n",a‒b);

} /*sub */

void mul()

{

int a=10,b=5;

printf("The multiplication value is : %d\n", a*b);

getch();

} /*mul */

OUTPUT:

The addition value is: 15

The subtract value is : 5

The multiplication value is: 50

EXPLANATION: In the above program three user defined function add(), sub(), mul(). The main function calls these three functions. These functions are called as per the calling sequence and print the result as output.


Computer Programming C Laboratory: Functions C Programs : Tag: C Programming : - C Program to print addition, subtraction and multiplication values using functions (Function with no arguments and no return values)


Computer Programming C Laboratory: Functions C Programs



Under Subject



Related Subjects