// Program by Akash Tripathi (@proakash256)
#include <stdio.h>
void Using_goto(int , int);
void Using_recursion(int , int);
int main()
{
int a, b;
printf("Enter the first number : ");
scanf("%d", &a);
printf("\nEnter the second number : ");
scanf("%d", &b);
// Method 1 : Using goto keyword
Using_goto(a , b);
// Method 2 : Using Recursion
printf("\n\nUsing Recursion :\n");
Using_recursion(a , b);
return 0;
}
void Using_goto(int a , int b)
{
printf("\nUsing goto keyword :\n");
print :
printf("%d " , a);
a = a + 1;
if(a <= b)
goto print;
return;
}
void Using_recursion(int a , int b)
{
printf("%d " , a);
a = a + 1;
if(a <= b)
Using_recursion(a , b);
return;
}
Comments
Post a Comment