Function In C Language
#include<stdio.h>
#include<conio.h>
void main()
{
void sum();
clrscr();
printf("This program calculate the sum of two number");
sum();
getch();
}
void sum()
{
int x,y,result=0;
printf("Enter the value");
scanf("%d%d",&x,&y);
result=x+y;
printf("The sum of two number =%d",result);
getch();
}
------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
void main()
{
void sum(int,int)
int x,y;
clrscr();
printf("This program calculate the sum of two number");
printf("Enter the value");
scanf("%d%d",&x,&y);
sum(x,y);
getch();
}
void sum(int a,int b)
{
int result=0;
result=a+b;
printf("The sum of two number =%d",result);
}
-----------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
void main()
{
int sum(int,int)
int x,y,result=0;
clrscr();
printf("This program calculate the sum of two number");
printf("Enter the value");
scanf("%d%d",&x,&y);
result=sum(x,y);
printf("The sum of two number =%d",result);
getch();
}
int sum(int a,int b)
{
int s=0;
s=a+b;
return(s);
}