I will not correct anything, but I will use code tags in my post (as you should too).
See
http://www.cplusplus.com/articles/jEywvCM9/
With the tags, some indentation and couple comments:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include<stdio.h>
main()
{
int N,num,sum=0;
do
{ // begin do block
printf("Enter a number:\n");
scanf("%d",&N);
if ( (N>9999) (N<0) )
{
printf("Wrong Number\n");
}
while ( (N>9999) )
(N<0) ) ;
num=N;
while ( N>0 )
{
sum=sum+N%10;
N=N/10;
}
printf("Sum of digits of the number%d is%d",N,sum);
} // end do block ?
} // error mentions this brace. There was no "while (cond);" after end of do block.
|
Apart from that, you do have mismatching parentheses and weird conditional expressions.
The C and C++, unlike Python, treat most whitespace (indentation) optional, but having some makes reading the code easier.
Many text editors do support syntax highlighting and indentation and those are useful features.
The compiler does include in the error message the line-number, where it thinks the error to occur. IDE can even hyperlink to the problematic line of code.
When reading compiler errors, always start from the
first. The later errors can be just product of compiler being side-tracked by earlier errors.