| | |
Print star pattern
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2009
Posts: 28
Reputation:
Solved Threads: 0
Hi,
I would like to print star pattern in the following way -
****
***
**
*
main()
int i;
clrscr();
for(i=4;i<=4;i++)
{
printf("*");
getch();
}
It prints starts like ****
I don't know how to complete the program. Can anyone please do the complete program for this so that stars are printed in the manner as given above.
Thanks
I would like to print star pattern in the following way -
****
***
**
*
main()
int i;
clrscr();
for(i=4;i<=4;i++)
{
printf("*");
getch();
}
It prints starts like ****
I don't know how to complete the program. Can anyone please do the complete program for this so that stars are printed in the manner as given above.
Thanks
0
#2 Nov 2nd, 2009
try two for loops...one embedded into the other
C Syntax (Toggle Plain Text)
for (i = 0; i < num; ++i) { for (j = 0; j < num2; ++j) {} }
•
•
Join Date: Jun 2009
Posts: 28
Reputation:
Solved Threads: 0
0
#3 Nov 2nd, 2009
•
•
•
•
try two for loops...one embedded into the other
C Syntax (Toggle Plain Text)
for (i = 0; i < num; ++i) { for (j = 0; j < num2; ++j) {} }
1
#5 Nov 2nd, 2009
•
•
•
•
Its just an example that I made up..The numbers signify nothing.
•
•
•
•
Can anyone please do the complete program for this so that stars are printed in the manner as given above.
Some clue:
One loop inside another one as previously said.
Outer loop is the number of rows.
Inside loop number of stars for each row printed minus one less than previous row.
Last edited by Aia; Nov 2nd, 2009 at 1:18 am.
![]() |
Other Threads in the C Forum
- Previous Thread: How to split string into a structure?
- Next Thread: Can embedded server be accessed by external applications?
Views: 348 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for C
#include adobe ansi api array arrays asterisks binarysearch calculate centimeter char command convert copyimagefile cprogramme creafecopyofanytypeoffileinc csyntax directory dynamic fflush file fork forloop framework frequency functions getlasterror givemetehcodez grade graphics gtkgcurlcompiling hacking hardware highest homework inches incrementoperators kernel km lazy linked linkedlist linux linuxsegmentationfault list lists locate logical_drives looping loopinsideloop. match matrix microsoft motherboard multi mysql number opendocumentformat opensource owf pattern pdf performance pointer posix problem probleminc process program programming radix recursion recv repetition research scanf scheduling scripting segmentationfault sequential shape socket socketprograming spoonfeeding stack standard string strings structures student systemcall threads turboc unix user variable voidmain() wab win32 windows.h






