title: How do i write a program that calculates the product of a number's digits that are different from another number i input?
body: <p>I have to input 2 numbers, n and k, and find the product of n's digits which are different from k.
  Example: n = 1234, k=2, and the product should be 1 * 3 * 4;</p>
  <pre><code>    #include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
      int n, k, p=1, digit;
      cin &gt;&gt; n &gt;&gt; k;
  
      while(true){
              digit= n % 10;
  
          if(digit != k){
              p = p * digit;
          }
          n = n/10;
      }
      cout &lt;&lt; &quot;Product of digits different from K is: &quot; &lt;&lt; p;
      return 0;
  }
  </code></pre>
  <p>When i run it, after i input n and k, the program doesnt do anything else and just keeps the console open without an output.</p>