Can anyone help me? | SoloLearn: Learn to code for FREE!


Can anyone help me?

1/22/2021 3:53:01 AM

Ira Sarkar

1 Answer

New Answer


Line number 8, scanning %d%d%d from the input is the problem. You cannot scan %d%d%d and expect that the three numbers will be scanned fine, because how is the computer supposed to know where a number ends if there is nothing separating the 3 numbers? Just try printing the values of the 3 variables to the screen printf("%d %d %d", ram, shyam, ajay); if I give the input '202122', it will print 202122 <some-number> <some-other-number> This is because the input value is assigned to ram and the other variables retain their original undefined value. The fix is simple. Add a separator between the three %d like a comma or space and enter the input in that format.