How to keep taking input till the input is not 0.
Please tell me how to write the code for this
Please tell me...,
you can write:
while(cin>>x){
}
I think you haven’t saved the code . It contains only the basic template of coding blocks.
Aman the code is there in the url id that i’ve given you.It’s showing for me
Can you please send it again. I’m unable to see any code.
Can you please tell the approach for this problem?
@AKKI You can simply apply Brute force(using sieve), calculate sum of factors for numbers till 1e5 and check whether any number has this sum present in the array otherwise print “-1”.
For reference, use this: https://ide.codingblocks.com/s/188871
Hope it helps.
Why is your logic working in given code?
I told you the logic already. Its just the implementation.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.