can u please tell me why i am getting compilation error in this code?
Simple input problem
hey @lovely i have corrected your code :
please go through it and let me know if there is something you didnt understand .
Happy Learning !!
it is not accepting the first number while printing why?
but i think in line no 8 of code u took sum variable instead of taking number as constraint.rest was correct .and then after editing it ,it was working.
@lovely no in while loop i have taken and in comparison because your condition with while as or was disturbing the loop .
ok, and i have one doubt also that why we are using cin>>n in line 17 when we already have used in lineno6?and when i tried to run code by removing it then ,it was showing time limit exceeded.
in while condition you have made condition like that ,thatβs why we have done it in this way otherwise if we will not take input like this then the while loop will never terminate and it will eventually end up with an error .
:ok thanks for the explanation :
hello @lovely if you feel that your doubt is cleared please mark this doubt as resolved and do give the star ratings .
Happy Learning !!