I want to get 4 numbers from user like 1234(printf("enter 4 numbers: "); and separate them like 12 and 34 the out put I mean:
year: 12
month: 34
You did not explain what you can read from users very clearly. Say you get the input from the following code:
int a;
scanf("%d", &a);
and you are very sure that the input is definitely a 4-digit integer. You can do:
int a1 = a / 100;
int a2 = a % 100;
printf("%d, %d", a1, a2);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.