| | |
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?
| Thread Tools | Search this Thread |
adobe ansi api array arrays bash binarysearch centimeter char convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic fflush file floatingpointvalidation fork frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling hardware highest homework i/o ide inches infiniteloop initialization interest kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix meter microsoft motherboard multi mysql odf open opendocumentformat opensource openwebfoundation owf pattern pdf performance pointer pointers posix power probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string strings structures suggestions systemcall test testautomation unix urboc user voidmain() wab win32api windows.h






