Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
Every data type has a range Values that it can store, for any value beyond this range it will give some random output. In your program, may be you are crossing that range. Try with using another data type long long int and your program will work. Here is the link for data types and how to use them- https://www.google.com/amp/s/www.geeksforgeeks.org/data-types-in-c/amp/
12th Sep 2019, 8:51 AM
Vijay Meena
+ 3
By default 'int' type Considered as 'Signed '. Range of signed integer is '2147483647 to - 2147483648' in 32 bit system. If you want to work only on unsigned int, then change the data type accordingly. Use %u print final result, instead of %d.
12th Sep 2019, 9:07 AM
Kuri
Kuri - avatar
+ 2
Error of stack overflow: use "long" en instead de "int". int tiene 2 bytes y uso largo 4 bytes
12th Sep 2019, 8:55 AM
Giovanny Avila
Giovanny Avila - avatar