Prime visit problem

why run error is happening in my code, please check

Hello @Basant-Kumar-1342173592623612

In your solution you have declared an array “factor” of size 100 while you are accessing an index
much greater than 100 as a and b can lie between 1 to 1000000

still not resolved why it is showing wrong ans!

In line 16
j = 1 will divide every number and thus will always increment factor[i]
start j with 2 and end it with i - 1

Here is the code https://ide.codingblocks.com/s/157839

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.