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?

烟雨青岚
Release: 2020-07-06 10:20:16
Original
15155 people have browsed it

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
Copy after login

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
Copy after login

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!

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