Home > Backend Development > C#.Net Tutorial > What is the expression of perimeter in C language?

What is the expression of perimeter in C language?

下次还敢
Release: 2024-04-27 22:21:43
Original
807 people have browsed it

In C language, the perimeter is represented by a variable. For decimal perimeters, use floating-point variables (float), such as float perimeter;; for integer perimeters, use integer variables (int), such as int perimeter;.

What is the expression of perimeter in C language?

Representation of perimeter in C language

In C language, perimeter is usually represented by variables. Two commonly used methods are listed below:

1. Use floating-point variables

  • Floating-point variables can represent decimals, so they are suitable for storing perimeters .
  • Variable type: float
  • Declaration example: float perimeter;

2. Use integers Type variable (only integer perimeter)

  • If the perimeter is an integer, you can use an integer variable.
  • Variable type: int
  • Declaration example: int perimeter;

Which type to choose Values ​​that depend on the perimeter:

  • If the perimeter may contain decimals, use a float variable.
  • If the perimeter is an integer, you can use an integer variable.

The above is the detailed content of What is the expression of perimeter 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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template