write a c program to find the sum of two numbers using functions,write a program to add two numbers using function,c program to add two numbers using user defined function
Write a c program to find the sum of two numbers using functions
#include<stdio.h>
#include<conio.h>
void main()
{
int add(int a, int b); //function prototype
int a,b,sum;
clrscr();
printf(“Enter two numbers:\n”);
scanf(“%d%d”,&a,&b);
sum=add(a,b); // function call
printf(“Sum=%d”,sum);
getch();
}
int add(int a, int b)
{
return(a+b);
}
Output:
Enter two numbers:
2
3
No comments: