Created
August 27, 2018 16:33
-
-
Save benoffi7/19b4946b02a5d9df12141aa88edea764 to your computer and use it in GitHub Desktop.
Hey Jude by The Beatles con recursividad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
cantarEstribilloCompleto(2,0); | |
return 0; | |
} | |
void cantarNaNaNa(int limite, int vuelta) | |
{ | |
if (vuelta<limite) | |
{ | |
printf("-Nah-"); | |
cantarNaNaNa(limite,vuelta+1); | |
} | |
} | |
void cantarEstribillo() | |
{ | |
cantarNaNaNa(9,0); | |
printf("-Hey Jude!-"); | |
} | |
void cantarEstribilloCompleto(int limite, int vuelta) | |
{ | |
if (vuelta < limite) | |
{ | |
cantarEstribillo(); | |
printf("\n"); | |
cantarEstribilloCompleto(limite,vuelta+1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment