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 | |
|
|
Yahoo! Groups Links
- To reply to this message, go to:
http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=3644
Please do not reply to this message via email. (more info)
- To visit your group on the web, go to:
http://groups.yahoo.com/group/Programmers-Town/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
