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("For div(%d, %d)\n", x, y);<br />

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

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

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

x = 7;<br />

y = -3;<br />

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

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

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

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

x = -5;<br />

y = 3;<br />

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

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

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

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

x = 7;<br />

y = 7;<br />

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

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

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

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

x = 7;<br />

y = 0;<br />

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

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

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

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

}<br />

div (Continued)<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

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

Output:<br />

For div(7, 3)<br />

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

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

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

}<br />

Đầu ra:<br />

Không thể tìm thấy biến môi trường BAO GỒM<br />

các phòng thí nghiệm<br />

Mô tả: Tính giá trị tuyệt đối của một số nguyên dài.<br />

Bao gồm:<br />

Prototype: phòng thí nghiệm dài (i dài);<br />

Đối số: i giá trị số nguyên dài<br />

Quay trở lại giá trị: Trả về giá trị tuyệt đối của tôi.<br />

Bình luận: Một số âm được trả về là tích cực; một số dương là<br />

không thay đổi.<br />

Ví dụ: # include / * Cho printf * /<br />

# include / * Cho các phòng thí nghiệm * /<br />

int main (void)<br />

{<br />

i dài;<br />

i = 123456;<br />

printf ("Giá trị tuyệt đối của% 7ld là 6LD% \ n",<br />

i, các phòng thí nghiệm (i));<br />

i = -246.834;<br />

printf ("Giá trị tuyệt đối của% 7ld là 6LD% \ n",<br />

i, các phòng thí nghiệm (i));<br />

i = 0;<br />

printf ("Giá trị tuyệt đối của% 7ld là 6LD% \ n",<br />

i, các phòng thí nghiệm (i));<br />

}<br />

Đầu ra:<br />

Các of123456 giá trị tuyệt đối là 123.456<br />

Giá trị tuyệt đối là 246.834 -246.834<br />

Giá trị tuyệt đối của 0 là 0<br />

getenv (Tiếp theo)<br />

Thư viện chuẩn C với hàm toán học<br />

2004 Microchip Technology Inc DS51456B trang 283<br />

ldiv<br />

Mô tả: Tính thương và phần còn lại của hai số nguyên dài.<br />

Bao gồm:<br />

Prototype: ldiv_t ldiv (numer dài, denom dài);<br />

Đối số: numer tử số<br />

denomdenominator

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

Saved successfully!

Ooh no, something went wrong!