16.Pattern using recursion in C
#include<stdio.h>
void pattern(int x);
int main(){
int value;
printf("Enter a value :");
scanf("%d",&value);
pattern(value);
return 0;
}
void pattern(int x)
{
if(x==0)
return;
else
{
pattern(x-1);
for(int i=1; i<=2*x-1; i++)
{
printf("*");
}
printf("\n");
}
}
Comments
Post a Comment