foo.c:2:6: warning: return type of 'main' is not 'int' [-Wmain]
2 | void main()
| ^~~~
foo.c: In function 'main':
foo.c:4:5: error: expected ',' or ';' before 'scanf'
4 | scanf("%d",&n); //输入该二进制数
| ^~~~~
foo.c:5:5: error: 'while\U0000ff08n\U0000ff09' undeclared (first use in this function)
5 | while(n) //循环条件为n,即二进制数n在不为0的时候程序一直成立
| ^~~~~~~~~~
foo.c:5:5: note: each undeclared identifier is reported only once for each function it appears in
foo.c:5:15: error: expected ';' before '{' token
5 | while(n) //循环条件为n,即二进制数n在不为0的时候程序一直成立
| ^
| ;
6 | { sum+=(n%10)*p; //数字中所有位乘以本位的位权再加和
| ~
foo.c:3:17: warning: unused variable 'p' [-Wunused-variable]
3 | { int n,sum=0,p=1 //n为二进制数,sum为每一位计算所加的和,p为位权
| ^
foo.c:3:11: warning: unused variable 'sum' [-Wunused-variable]
3 | { int n,sum=0,p=1 //n为二进制数,sum为每一位计算所加的和,p为位权
| ^~~
foo.c:3:9: warning: unused variable 'n' [-Wunused-variable]
3 | { int n,sum=0,p=1 //n为二进制数,sum为每一位计算所加的和,p为位权
| ^
[Hydro](https://hydro.ac)提供评测服务