Yêu cầu:Viết chương trình nhập vào một biển số xe gồm bốn chữ số và kiểm tra biển đã nhập có mấy nút.VD:biển số 0123 có 6 nút.
int main(void)
{
char c[4]="";
int i=0,j=0,so=1,S=0;
do
{
while((c[i]=getchar())!='\n'&&i<4)
i++;
while((c[j])!=' '||(c[j])!='\0')
{
j++;
if(isdigit(c[i]))
so=1;
else
{
so=0;
break;
}
}
if(j!=4&&so==0)
printf("Bien so da nhap khong hop le.");
}
while(j!=4&&so==0);
for(int k=0; k<4; k++)
S=S+c[i];
printf("Bien so xe da nhap co %d nut",S);
return 0;
}