33 lines
519 B
C
33 lines
519 B
C
#include <stdio.h>
|
|
|
|
// Declaración de función recursiva
|
|
int rec(int num1, int num2, int n);
|
|
|
|
// Función recursiva rec
|
|
int rec(int num1, int num2, int n)
|
|
{
|
|
if (num1 >= num2)
|
|
{
|
|
n = rec(num1 - num2, num2, n + 1);
|
|
}
|
|
return n;
|
|
}
|
|
|
|
// Función principal (main)
|
|
int main()
|
|
{
|
|
int num1, num2, n = 0;
|
|
|
|
printf("Input num1: ");
|
|
scanf("%d", &num1);
|
|
|
|
printf("Input num2: ");
|
|
scanf("%d", &num2);
|
|
|
|
int result = rec(num1, num2, n);
|
|
|
|
printf("Result: %d\n", result);
|
|
|
|
return 0;
|
|
}
|