Home > Backend Development > C#.Net Tutorial > What is the integer division symbol in C language?

What is the integer division symbol in C language?

烟雨青岚
Release: 2020-06-30 11:38:48
Original
32466 people have browsed it

The integer division symbol in C language is the "/" symbol. What should be noted with the integer division operator (/) is that the operation result will be automatically converted to the same data type as the dividend.

What is the integer division symbol in C language?

In C language, integer division is the / symbol, and the % symbol is the remainder operator.

What you need to note about the integer division operator (/) is that the operation result will be automatically converted to the same data type as the dividend.

Examples are as follows:

int a=5, b=2;
float c;
c = a/b; 
 // 运算结果为2.0,而不是2.5,因为a是int型的,所以计算结果会转换为int型,
 // 而c又是float型的,所以最后将整型的2转换为float型。
Copy after login

Recommended tutorial: "C Language"

The above is the detailed content of What is the integer division symbol in C language?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template