a big proplem

every time i try to run this program it takes time to start can any body tell me why
here is the code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include<stdio.h>
#include<conio.h>
main()
{
      int x=0,y=0,c=0;
      float avg;
      while(x>=0)
      {
               printf("enter a non negative number\n");
                 scanf("%d",&x);
                 if(((x%5)==0)&&x>=0)
                { y+=x;
                 c++;}
                 else
                 continue;
      
      }
      avg=(y*1.0)/c;
      printf("the average is %f",avg);
      getch();
}
                 
Maybe whatever you're using compiles it first.
You might also try adding fflush(stdout); after line 9. The program may be running fine, but the OS isn't flushing the output.
Topic archived. No new replies allowed.