## modaslam

hello,
Can any one tell me how to print the patter

``````*
***
*
for n =1
**
****
****
**
for n = 2
***
*****
*****
*****
***
for n = 3``````

the code i am having is

``````for(i=0;i<=n;i++)
{
for(j=1;j<n-i;j++)
putchar(' ');
for(k=0;k<=i;k++)
printf('* ');
putchar('\n');
}``````

what will be the condition so that i will get that pattern
thanking you

## Narue 5,707

You're over-engineering the solution. It's really nothing more than this:

``````print ' '
print n '*'

for i = 0 to n do
print n + 2 '*'
loop

print ' '
print n '*'``````

## modaslam

You're over-engineering the solution. It's really nothing more than this:

``````print ' '
print n '*'

for i = 0 to n do
print n + 2 '*'
loop

print ' '
print n '*'``````

but how do i convert this code in to C code??

## Aia 1,977

>but how do i convert this code in to C code??

print ' ' ---> How would you display a space in C?
print n '*' ---> How would you display a * as many times as n is equals to?

for i = 0 to n do
print n + 2 '*' ---> How would you display in C a * n times plus 2 more?
loop ---> How would you loop in C from 0 to n?

print ' ' ---> How would you display a space in C?
print n '*' ---> How would you display a * as many times as n is equals to?

## modaslam

>but how do i convert this code in to C code??

print ' ' ---> How would you display a space in C?
print n '*' ---> How would you display a * as many times as n is equals to?

for i = 0 to n do
print n + 2 '*' ---> How would you display in C a * n times plus 2 more?
loop ---> How would you loop in C from 0 to n?

print ' ' ---> How would you display a space in C?
print n '*' ---> How would you display a * as many times as n is equals to?

Okay I apologize .....

## Narue 5,707

>but how do i convert this code in to C code??
There's a reason I didn't give you C code. ;)