Home >Backend Development >C#.Net Tutorial >Is '%' an operator that can only be used for integer operations in a C program?

Is '%' an operator that can only be used for integer operations in a C program?

烟雨青岚
烟雨青岚Original
2020-07-06 10:03:2715174browse

In C programs, "%" is an operator that can only be used for integer operations. "%" is the remainder (or remainder) operator in C language, which means: divide the value of one expression by the value of another expression and return the remainder; the basic syntax is "result = num1 % num2".

Is '%' an operator that can only be used for integer operations in a C program?

In c programs, "%" is an operator that can only be used for integer operations.

"%" means: divide the value of one expression by the value of another expression and return the remainder.

The syntax is:

result = number1 % number2

Parameters

result Any variable.

number1 Any numeric expression.

number2 Any numeric expression.

Description

The remainder (or remainder) operator divides number1 by number2 (rounding the floating point number to an integer), and then returns only the remainder as result.

For example, in the following expression, A (result) is equal to 5.

A = 19 % 6.7

Recommended tutorial: "C Language"

The above is the detailed content of Is '%' an operator that can only be used for integer operations in a C program?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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