Skip to content

Instantly share code, notes, and snippets.

@GReturn
Created February 18, 2024 09:27
Show Gist options
  • Save GReturn/c5bde0e2376ca694a477bd2c062b293f to your computer and use it in GitHub Desktop.
Save GReturn/c5bde0e2376ca694a477bd2c062b293f to your computer and use it in GitHub Desktop.
Square - Recursive Implementation
#include <stdio.h>
void pr(int wid)
{
if(wid == 0)
{
printf("\n");
return;
}
printf("* ");
return pr(wid-1);
}
void ph(int n, int m)
{
if(n==0) return;
pr(m);
return ph(n-1, m);
}
int main(int argc, char const *argv[])
{
int base = 5;
int height = 5;
ph(base, height);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment