By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

how to solve this program errors

P: 2
Expand|Select|Wrap|Line Numbers
  1. ‪#‎include‬<stdio.h>
  2. #include<conio.h>
  3. int main()
  4. {
  5. int i, j, n=20, temp,c;
  6. do{
  7. temp=n/4;
  8. for(i=1; i<=n/4; i++)
  9. {printf(“\t\t”);
  10. for(j=1; j<temp; j++)
  11. printf(” “);
  12. temp–;
  13. for(j=1; j<=2*i-1; j++)
  14. printf(“*”);
  15. printf(“\n”);
  16. }
  17. temp=n/3;
  18. for(i=3; i<=n/3; i++)
  19. {printf(“\t “);
  20. for(j=1; j<temp; j++)
  21. printf(” “);
  22. temp–;
  23. for(j=1; j<=2*i-1; j++)
  24. printf(“*”);
  25. printf(“\n”);
  26. }temp=n/2;
  27. for(i=4; i<=n/2; i++)
  28. {printf(“\t”);
  29. for(j=1; j<temp; j++)
  30. printf(” “);
  31. temp–;
  32. for(j=1; j<=2*i-1; j++)
  33. printf(“*”);
  34. printf(“\n”);
  35. }
  36. for(i=0;i<5;i++){
  37. printf(“\t\t “);
  38. printf(“***”);
  39. printf(“\n”);}
  40. printf(“\t\t *******”);
  41. printf(“\npress 1 to recontinue to this program otherthan press any key:”);
  42. scanf(“%d”,&c);}
  43. while(c==1);
  44. getch();
  45. return 0;
  46. }
Jun 1 '16 #1

✓ answered by donbock

I notice the fourth line from the bottom is
Expand|Select|Wrap|Line Numbers
  1. while(c==1);
Your program will spin here forever if c is 1.

Share this Question
Share on Google+
3 Replies


Expert 100+
P: 2,396
Please reenter your program using CODE Tags.

What error are you getting?
Does it occur at compile-time, link-time, or run-time?
Is there an error message? If so, please provide it.
Jun 1 '16 #2

Expert 100+
P: 2,396
I notice the fourth line from the bottom is
Expand|Select|Wrap|Line Numbers
  1. while(c==1);
Your program will spin here forever if c is 1.
Jun 1 '16 #3

P: 2
in this program on ' expression syntax ' error
Jun 1 '16 #4

Post your reply

Sign in to post your reply or Sign up for a free account.