#include <stdio.h> void printpattern(int n); int main() { int n = 4; printpattern(n); //code return 0; } void printpattern(int n){ int i; if(n == 1){ printf("*\n"); return; } printpattern(n-1); for(i=0;i<2*n-1;i++){ printf("*"); } printf("\n"); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter