#include<stdio.h> #include<stdbool.h> #include<conio.h> #include<math.h> #include<string.h> void main() { int temp, i, j; temp = 0; char chars[20]; printf("enter chars : "); gets(chars); if(chars[0] != 'G') { temp = 1; } else if (chars[1] != 'C') { temp = 1; } else { for (i = 2; i < strlen(chars);i++) { if(isdigit(chars[i]) == 0) { temp = 1; } break; } } if ( temp == 0) { printf("student ID: "); puts(chars); } else { printf("enter error"); } getch(); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter