kiểm tra nhập đúng độ dài kí tự

PHOTO EMBED

Thu Aug 19 2021 03:02:11 GMT+0000 (Coordinated Universal Time)

Saved by @_Ryan_ #c

#include<stdio.h>
#include<stdbool.h>
#include<conio.h>
#include<math.h>
#include<string.h>

void main()
{
   int result;
   char studentID[20];

   printf("enter ID length  must is 7 characters: ");
A:
   gets(studentID);

   result = strlen(studentID);

   if(result == 7)
   {
       printf("true");
   }
   else
   {
       printf("ID length  must is 7 characters\n");
       printf("re-enter : ");
       goto A;
   }

    getch();

}
content_copyCOPY