hiiii, saud i'm girish
i'm sendin' u this prg to print diamond usin' for loop try it out.
i think for  3  must be
*
* *
* * *
  * *
    *
this prg will print first three lines in one major for loop ang remainin' 2 in secong major for loop.
do it usin' recursion  urself. it's an easy problem
 

#include<stdio.h>

#include<conio.h>

main()

{

int i,n,j;

clrscr();

scanf("%d",&n);

for(i=1;i<=n;i++)

{

for(j=1;j<=i;j++)

printf("*");

printf("\n");

}

for(i=1;i<n;i++)

{

for(j=1;j<=i;j++)

printf(" ");

for(j=n-i;j>=1;j--)

printf("*");

printf("\n");

}

getch();

}



saud aziz <[EMAIL PROTECTED]> wrote:

Can anyone tell me using for loop as well as (if possible) with
recursion how would i make a program that creates diamond like this:

1     *

2     *
      **
       *

3     *
      **
     ***
      **
       *

for a function that takes in # of lines, so the last diamond above
should be displayed if user enters 3.


--
"Our lives begin to end the day we become silent about things that
matter." Dr. Martin Luther King Jr.





To unsubscribe : [EMAIL PROTECTED]




_______________________________________ ___________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

To unsubscribe : [EMAIL PROTECTED]




Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=315388.5526708.6599542.3001176/D=groups/S=:HM/A=2372354/rand=354663700


Yahoo! Groups Links

Reply via email to