I wanted to ask, is it possible to print patterns through functions in c?
In the case it is possible, then please tell me what mistake am I making in the program below. (for the first time perhaps, I am trying to create something without my teacher's asking.)
#include <stdio.h>
int pattern(int);
void main()
{
int n, r;
printf("Enter the value of n:");
scanf("%d",&n);
r=pattern(n);
printf("%d",r);
}
int pattern(int n)
{
int i, j;
for(i=1;i<=n;i++)
{
for(j=1;j<i;j++)
{
return j;
}
}
}
Thanks.