一个统计票数的题,哪里错了求指点
#include<stdio.h>int main(){
int val,i,onuser = 0,one = 0,two = 0,three = 0,num[100];
printf("please input the number of electorate:\n");
scanf("%d",&val);
printf("please input 1or2or3\n");
for(i = 0;i < val;i++)
{
scanf("%d",num[i]);
if(num[i] == 1)
one++;
if(num[i] == 2)
two++;
if(num[i] == 3)
three++;
else
onuser++;
}
printf("The result:\n");
printf("canfidate1:%d",one);
printf("canfidate2:%d",two);
printf("canfidate3:%d",three);
printf("onuser:%d",onuser);
}