Program 3: Design a function sum, which takes two integer values and make addition and does not return addition to calling function. But sum function itself print addition into its body. (C function with arguments and without return value or return type)
#include< stdio.h >
#include< conio.h >
void main ()
{
int a,b,c;
void sum (int ,int);
/only mentioning data type is also allowed in function prototype/
printf(“\n Enter two number ”);
scanf(“%d %d ”& a, &b);
sum (a, b);
getch();
}
void sum (int a, int b)
{
int c;
c=a + b;
printf(“\n Addition is =%d ”,c);
}
Output:
Enter two number
21
31
Addition is =52
0 Comments