30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

printf("The quotient is %ld and the "<br />

"remainder is %ld\n\n", z.quot, z.rem);<br />

x = -5;<br />

y = 3;<br />

printf("For ldiv(%ld, %ld)\n", x, y);<br />

z = ldiv(x, y);<br />

printf("The quotient is %ld and the "<br />

"remainder is %ld\n\n", z.quot, z.rem);<br />

x = 7;<br />

y = 7;<br />

printf("For ldiv(%ld, %ld)\n", x, y);<br />

z = ldiv(x, y);<br />

printf("The quotient is %ld and the "<br />

"remainder is %ld\n\n", z.quot, z.rem);<br />

x = 7;<br />

y = 0;<br />

printf("For ldiv(%ld, %ld)\n", x, y);<br />

z = ldiv(x, y);<br />

printf("The quotient is %ld and the "<br />

"remainder is %ld\n\n",<br />

z.quot, z.rem);<br />

}<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

DS51456B-page 284 2004 Microchip Technology Inc.<br />

Output:<br />

For ldiv(7, 3)<br />

The quotient is 2 and the remainder is 1<br />

For ldiv(7, -3)<br />

The quotient is -2 and the remainder is 1<br />

For ldiv(-5, 3)<br />

The quotient is -1 and the remainder is -2<br />

For ldiv(7, 7)<br />

The quotient is 1 and the remainder is 0<br />

For ldiv(7, 0)<br />

The quotient is -1 and the remainder is 7<br />

Explanation:<br />

In the last example (ldiv(7,0)) the denominator is zero, the behavior<br />

printf ("\ n");<br />

printf ("Sắp xếp liệt kê:");<br />

for (x = 0; x

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!