My program asks the user for a year like 2056. So in main, I use scanf.
However, I have a function which requires the first 2 digits of this value only.
I've tried using another scanf inside the function itself scanf("%2d"...) but then I can't have the other scanf in main for my other functions.
So how can I do this?
int year = 2056;
int firstPart = year / 100;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With