Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example Analysis of div () function in C language

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this article Xiaobian for you to introduce in detail the "C language div () function example analysis", the content is detailed, the steps are clear, the details are handled properly, I hope this "C language div () function example analysis" article can help you solve your doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.

Original function:

Div_t div (int numer, int denom)

Function description: div_t div (int numer, int denom) divides numer (numerator) by denom (denominator).

Parameters:

Return value:

The structure of the function return value definition is in, which has two members. For div_t:int quot; int rem

How to use the div () function:

# include

# include

Int main () {

Div_t output

Output = div (27,4)

Printf ("Quotient part of (29 / 4) =% d\ n", output.quot)

Printf ("Remainder part of (29thumb 4) =% d\ n", output.rem)

Output = div (27,3)

Printf ("Quotient part of (30 / 3) =% d\ n", output.quot)

Printf ("Remainder part of (30amp 3) =% d\ n", output.rem)

Return (0)

Compile and run the above program to produce the following results:

Quotient part of (29 / 4) = 7

Remainder part of (29ax 4) = 1

Quotient part of (30 / 3) = 10

Remainder part of (30Accord 3) = 0

Read this, the "C language div () function example analysis" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more related articles, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report