Joao_Joao

Questão 254 Lista de Exercícios IFPB

May 1st, 2022 (edited)
1,091
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int f(int a, int b) {
  4.   if(b == 0) return 0;
  5.   return a + f(a, b - 1);
  6. }
  7.  
  8. int main() {
  9.   int x, y;
  10.   printf("Digite os valores de X e Y: ");
  11.   scanf("%d%d", &x, &y);
  12.   printf("O valor do produto de X por Y eh: %d\n", f(x, y));
  13.  
  14.   return 0;
  15. }
  16.  
Add Comment
Please, Sign In to add comment