error statement missing in c language

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hafsa khan
    New Member
    • Nov 2015
    • 1

    error statement missing in c language

    Code:
    #include<stdio.h>
    #include<conio.h>
    void main ()
    {
    int n,a;
    clrscr();
    n=1;
      do
        {
          do
    	{
    	  a=1;
    	  printf("A");
    	  a++;
    	}while(a<=n);
    	printf("\n")
           n=n+1;
         }while(n>=5);
       getch();
     }
    i am a studend..i am learning c language
    here is the program that shows the error statement missing in n=n+1. Why it shows the error?
    Last edited by zmbd; Nov 10 '15, 09:21 PM. Reason: [z{Please format the code using the [CODE/] tool - see faq}]
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    + Moved from Access/VBA to C-forums.
    + Please always use the [CODE/] format tool to format your posted script
    + Please pay attention to where you post your questions.

    We do not normally do homework problems.
    Can you tell us what you've done to trouble shoot this program and we'll guide you from there...

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      A syntax mistake on one line may not be detectable to the compiler until a subsequent line. In general, when the compiler reports an error, start at the indicated by the error message and scan upwards.

      By the way, consider your two loops. The outer loop has n going from 1 to 6. What is the range of a inside the inner loop when n is, let's say, 3?

      By the way, the C Standard requires that main return an int. You defined it to return void.

      Comment

      Working...