pls help me....!!!

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2009
Posts: 25
Reputation: nitu_thakkar has a little shameless behaviour in the past 
Solved Threads: 1
nitu_thakkar's Avatar
nitu_thakkar nitu_thakkar is offline Offline
Light Poster

pls help me....!!!

 
0
  #1
Mar 12th, 2009
i have to make one prg in c
that accept only odd number (no) which is (4>no>30) & have to
genrate the pertern which is given below

when no=7 then given petern should be genrated


for that i have do some coding but i can't get the exatly petern..

pls help to solve this problem

thanx in advance .....

  1.  
  2.  
  3.  
  4. #include<stdio.h>
  5. #include<conio.h>
  6.  
  7. void main()
  8. {
  9. int no,i,j,no1;
  10. clrscr();
  11.  
  12. printf("Enter Number Of Lines: ");
  13. scanf("%d",&no);
  14.  
  15. no1=no/2;
  16.  
  17. for(i=1;i<=no1;i++)
  18. {
  19. for(j=i;j<no;j++)
  20. printf(" ");
  21.  
  22. for(j=1;j<=i;j++)
  23. {
  24. if(j==1 || j==i)
  25. printf("* ");
  26.  
  27. else
  28. printf(" ");
  29. }
  30. printf("\n");
  31. }
  32. for(i=1;i<=no*2-1;i++)
  33. printf("*");
  34.  
  35. for(i=1;i<=no;i++)
  36. {
  37. if(i%2==0)
  38. {
  39. for(j=1;j<=i;j++)
  40. {
  41. //printf("*");
  42. }
  43.  
  44. }
  45. else
  46. printf("\n");
  47. }
  48.  
  49.  
  50. for(i=1;i<=no*2-1;i++)
  51. printf("*");
  52. printf("\n");
  53.  
  54. for(i=no1;i>0;i--)
  55. {
  56. for(j=i;j<no;j++)
  57. printf(" ");
  58.  
  59. for(j=1;j<=i;j++)
  60. {
  61. if(j==1 || j==i)
  62. printf("* ");
  63.  
  64. else
  65. printf(" ");
  66. }
  67. printf("\n");
  68. }
  69.  
  70. getch();
  71. }
Last edited by nitu_thakkar; Mar 12th, 2009 at 1:31 pm. Reason: pertern wes not proper formated
Attached Thumbnails
star.JPG  
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 151
Reputation: monkey_king is on a distinguished road 
Solved Threads: 8
monkey_king monkey_king is offline Offline
Junior Poster

Re: pls help me....!!!

 
0
  #2
Mar 12th, 2009
Hi,
I had som difficulties understanding what you wanted but I think I got it now.

You want draw a star with an uneven number of points using stdoutput?

Do you use some special algorithm for drawing the star,
or is that your problem?
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 25
Reputation: nitu_thakkar has a little shameless behaviour in the past 
Solved Threads: 1
nitu_thakkar's Avatar
nitu_thakkar nitu_thakkar is offline Offline
Light Poster

Re: pls help me....!!!

 
0
  #3
Mar 15th, 2009
@monkey_king
( thnax for ur reply )


my pertern should be look like when i give

no=7

then out put is look like

http://img353.imageshack.us/img353/8527/starj.jpg
Last edited by nitu_thakkar; Mar 15th, 2009 at 2:23 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum


Views: 342 | Replies: 2
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC