Program to accept two numbers and print sum of two numbers by using functions - 100 Most Important C# Programs

100 Most Important C# Programs

35. Program to accept two numbers and print sum of two numbers by using functions

Code:

# include <stdio.h>

# include <conio.h>

main( )

{

int a,b,c;

clrscr();

printf(“enter the value for a:”)

scanf(“%d”,&a);

printf(“enter the value for b:”)

scanf(“%d”,&b);

c=add(a,b);

printf(“sum of two numbers is %d”,c);

getch( );

}

int add(int x, int y)

{

int z;

z=x+y;

return z;

}