-3

does anyone know how todisplay the following using a for loop in my program

question:if n=5 where n is the ht of the pattern

*********
****   ****
***        ***
**             **
*                 *

if n=4

*******
***   ***
**       **
*           *

SOLUTION I TRIED OUT IS

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{printf("*");
}
printf("\n");
}
getch();
}

pls suggest modifications if anyone knows how to display the correct solution.

Votes + Comments
[URL="http://www.daniweb.com/forums/misc-explaincode.html"]code tags.[/URL]
48 Posts, no code tags, void main(), answer to your question: yes I know how to do that.
No code tags, more cookies!
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Dream2code
-1

does anyone know how todisplay the following using a for loop in my program

question:if n=5 where n is the ht of the pattern
*********
**** ****
*** ***
** **
* *
if n=4
*******
*** ***
** **
* *

SOLUTION I TRIED OUT IS
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{printf("*");
}
printf("\n");
}
getch();
}
pls suggest modifications if anyone knows how to display the correct solution.

Analyze the the thing
find out the logic and
make a dry/manual run of your code....!!!

HINT: concentrate on the change of the loop variables i and j!!

Votes + Comments
what??? your comment isn't even meaningful. and why do you feel the need to repost all his crappy, unformatted code. it was bad enough seeing it the first time
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.