Skip to content

Instantly share code, notes, and snippets.

@benoffi7
Created August 27, 2018 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benoffi7/19b4946b02a5d9df12141aa88edea764 to your computer and use it in GitHub Desktop.
Save benoffi7/19b4946b02a5d9df12141aa88edea764 to your computer and use it in GitHub Desktop.
Hey Jude by The Beatles con recursividad
#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