Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Assuming that from dry output you mean explanation of the code, here is my attempt at it.</p> <p>Suppose user enters <code>143</code>. So now <code>a = 143</code>.<br/></p> <pre><code>while( a != 0 ) // a = 143 therefor condition is true and the block of // code inside the loop is executed. b = a % 10 ; // 143 % 10 ( The remainder is 3 ) </code></pre> <p>So value of <code>b</code> is printed on screen</p> <blockquote> <p>3</p> </blockquote> <p>Now</p> <pre><code>c = a / 10 ; // 143 / 10 = 14 a = c ; // so now a = 14 </code></pre> <p>Once again, we return to the <code>while()</code></p> <pre><code>while( a != 0 ) // a = 14 therefor condition is true and the block of // code inside the loop is executed. b = a % 10 ; // 14 % 10 ( The remainder is 4 ) </code></pre> <p>So value of <code>b</code> is printed on screen, which already has <code>3</code></p> <blockquote> <p>34</p> </blockquote> <p>Now</p> <pre><code>c = a / 10 ; // 14 / 10 = 1 a = c ; // so now a = 1 </code></pre> <p>Again, we return to the <code>while()</code></p> <pre><code>while( a != 0 ) // a = 1 therefor condition is true and the block of // code inside the loop is executed. b = a % 10 ; // 1 % 10 ( its output will be 1 ) </code></pre> <p>So value of <code>b</code> is printed on screen which already has <code>34</code> </p> <blockquote> <p>341</p> </blockquote> <p>Now</p> <pre><code>c = a / 10 ; // 1 / 10 = 0 a = c ; // so now a = 0 </code></pre> <p>We return to the <code>while()</code></p> <pre><code>while( a != 0 ) // a = 0 therefor condition is FALSE and the block of // code inside the loop is NOT executed. </code></pre> <p>Hope it was helpful.<br/> <strong>Note</strong><br/> Instead of </p> <pre><code>c=a/10; a=c; </code></pre> <p>You can simply write</p> <pre><code>a /= 10 </code></pre> <p>Secondly,</p> <pre><code>int a,b,c,d,e; </code></pre> <p>What is the purpose of <code>e</code>?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload