Program to add between any two numbers using loop
#include
int main()
{
int x;
int a,b;
printf("Enter any two numbers :");
scanf("%d%d",&a,&b);
x=add(a,b);
printf("%d ",x);
}
int add(int a,int b)
{
while(a>0)
{
b++;
a--;
}
return b;
}
int main()
{
int x;
int a,b;
printf("Enter any two numbers :");
scanf("%d%d",&a,&b);
x=add(a,b);
printf("%d ",x);
}
int add(int a,int b)
{
while(a>0)
{
b++;
a--;
}
return b;
}
No comments
Post a Comment