+ 2
Please see this code! When i user input 10 or 20 the code works smoothly when user input 30 the milliseconds goes into - value?
10 Answers
+ 1
https://code.sololearn.com/c9FcO2jigQ5Z/?ref=app
+ 4
The int values in c are contained in this interval
[-2,147,483,648 to 2,147,483,647] that mean
(-2exp(-16) to 2exp(16)-1)
When the users put 30
The millisecond number will be greater than 2exp(16)-1 .so this value reach the negative value of int.you can imagine it like a circle :when you reach max positive value of int the next number will be the min value of int ,which mean hier negative value
+ 1
Aboubakar how can i stop this please tell me
+ 1
You can use the Type long int
+ 1
Instead of using Type int for milisecond and the others
Just use :long long int
For example
long long int milisecond;
+ 1
And with long long int var exemple
In printf("%lld",var);
+ 1
Aboubakar Not working at all
+ 1
Aboubakar thanks đ bro
+ 1
Welcome
0
Thanks.