Lista 8 Parte 2

Run Settings
LanguageC
Language Version
Run Command
#include <stdio.h> #include <stdlib.h> #include <locale.h> A(int x, int y){ if (x == 0) return y + 1; if (x > 0 && y == 0) return A(x - 1, 1); if (x > 0 && y > 0) return A(x - 1, A(x, y - 1)); } int main(){ int m = 3, n = 2; setlocale(LC_ALL, "Portuguese"); printf("O valor de A(3,2) é igual a %d", A(m, n)); return 0; }
#include <stdio.h> #include <stdlib.h> #include <locale.h> p(int n){ if (n == 0) return 0; if (n == 1) return 1; if (n > 2) return (2*p(n-1) + p(n-2)); } int main(){ int x; setlocale(LC_ALL, "Portuguese"); printf("Digite um valor: "); scanf("%d", &x); printf("O N-ésimo número de Pell deste valor é igual a %d", p(x)); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines