You are viewing a single comment's thread. Return to all comments →
A simple and perhaps readable solution..
You can use n instead of temp as its just a dummy..
else if(n%5 >= 3)
Why use EOF?
it stands for end of file
what is the use of temp?
to satisfy the input condition.
according to me it shouldn't work but if it passed test cases ,then i dont know how .the reason is that consider a number like 73 ,then n%5 should give 3 ,and hence it would redirect to the else statement and print n, whereas it should have printed 75 as we need to consider the next multiple of 5 ,75-73 =2 (<3) .Correct me ,if i am wrong ,anyone. (might be i am wrong too :P ,i developed my solution in my way ,though!)
73 % 5 = 3 and 3 <= 3, so it'll satisfy the else if condition.
Then we have cout << 73 + (5- 73%5) << endl; which simplifies to cout << 73 + 2 << endl;
Why are we checking <=3 and not some other number?
wow ..thank u
It is a achronym of null(0) in C language in stdio.h
cant understand use of temp here
try this code