Ugly Numbers - DP

Hello Sir/Ma’am, I am sharing my code for this problem, I am unable to handle the case where a number is a multiple of more than 1 prime no. out of 2,3,5 . eg:: 6 (multiple of 2 and 3 both) .It’s being added to the sequence twice. Could you please tell me how to handle this case? https://ide.codingblocks.com/s/212868

@priyanshi.agarwal3405
You just need to remove the “else” in the nest if conditions. so that it get incremented for each same dp[i] . like in the case of 6, both q and p needs to be incremented and use long long array.

Okay, thank you so much sir!!!