Advertisement
Joao_Joao

Questão 276 Lista de Exercícios IFPB

May 1st, 2022 (edited)
173
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3. N = 5
  4. OUTPUT:
  5. *****
  6. ****
  7. ***
  8. **
  9. *
  10.  
  11. */
  12.  
  13. #include <stdio.h>
  14.  
  15. unsigned int f(int num_ateriscos, int num_casos) {
  16.   if (num_casos == 0) return 0;
  17.   if (num_ateriscos == 0) {
  18.     printf("\n"), --num_casos;
  19.     return f(num_casos, num_casos);
  20.   }
  21.   printf("*");
  22.   return f(num_ateriscos - 1, num_casos);
  23. }
  24.  
  25. int main() {
  26.   int n;
  27.   printf("Digite o valor de N: ");
  28.   scanf("%d", &n);
  29.   f(n, n);
  30.  
  31.   return 0;
  32. }
  33.  
Advertisement
RAW Paste Data Copied
Advertisement