#include<stdio.h>
#include<conio.h>
int add(int,int);
int main()
{
int a,b,result;
printf("Enter value 1: ");
scanf("%d",&a);
printf("Enter value 2: ");
scanf("%d",&b);
result=add(a,b);
printf("Addition of %d and %d is %d",a,b,result);
getch();
return 0;
}
int add(int x,int y)
{
if(x==0)
return y;
else
return (add(--x,++y));
}
#include<conio.h>
int add(int,int);
int main()
{
int a,b,result;
printf("Enter value 1: ");
scanf("%d",&a);
printf("Enter value 2: ");
scanf("%d",&b);
result=add(a,b);
printf("Addition of %d and %d is %d",a,b,result);
getch();
return 0;
}
int add(int x,int y)
{
if(x==0)
return y;
else
return (add(--x,++y));
}
No comments:
Post a Comment
Convey your thoughts to authors.