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;

}





All materials on the site are licensed Creative Commons Attribution-Sharealike 3.0 Unported CC BY-SA 3.0 & GNU Free Documentation License (GFDL)

If you are the copyright holder of any material contained on our site and intend to remove it, please contact our site administrator for approval.

© 2016-2025 All site design rights belong to S.Y.A.