- 1

I need help fixing this code to take details from user and print it on the screen as entered by user

https://code.sololearn.com/cjZmAw581X0i/?ref=app

1st Mar 2021, 4:47 PM
Emmanuel Ifeanyichukwu
Emmanuel Ifeanyichukwu - avatar
6 odpowiedzi
+ 2
Amah Emmanuel Additionally to what visph pointed out about the size of the data type, if you need to work with numbers that possibly include leading zeroes, e.g. credit card numbers or mobile numbers, integral data types might not be suited as those zeroes will not be stored. Strings would be a better choice in that case.
1st Mar 2021, 6:12 PM
Shadow
Shadow - avatar
+ 3
just replace: scanf("%s", &a); by: scanf("%s", a);
1st Mar 2021, 4:53 PM
visph
visph - avatar
+ 3
because the number is too big ^^ just replace 'int x' with 'long x' and both '%d' by '%ld': you will handle higher upper limit ;)
1st Mar 2021, 5:28 PM
visph
visph - avatar
+ 2
working fine for me: https://code.sololearn.com/cnm8bIHG2vir/?ref=app btw, you must enter number without separators (neither spaces nor anything else -- dot, dash...), and in sololearn you must provide input as once, each on a new line: toto 1234567890
1st Mar 2021, 5:11 PM
visph
visph - avatar
0
Still prints random numbers instead of numbers inputs by user
1st Mar 2021, 5:07 PM
Emmanuel Ifeanyichukwu
Emmanuel Ifeanyichukwu - avatar
0
When I enter 08101519793 it outputs -488414799
1st Mar 2021, 5:22 PM
Emmanuel Ifeanyichukwu
Emmanuel Ifeanyichukwu - avatar