Lesson 02

Mathmatical Symbols in C

C is able to perform basic mathematical operations on variables and values using the following symbols:

Addition: +

Subtraction: –

Division: /

Multiplication: *

Incrementing: ++

Decrementing: —

Modulo: %


This content originally appeared on DEV Community and was authored by Mirsolih Mirzaahmad õğli

Lasson 02 pic.

Mathmatical Symbols in C

C is able to perform basic mathematical operations on variables and values using the following symbols:

  • Addition: +
  • Subtraction: -
  • Division: /
  • Multiplication: *
  • Incrementing: ++
  • Decrementing: --
  • Modulo: %

Assignment Operations in C

C can assign values to variables and perform basic mathematical operations using shorthand operators:

  • Assignment: =
  • Addition then assignment: +=
  • Subtraction then assignment: -=
  • Multiplication then assignment: *=
  • Division then assignment: /=
  • Modulo then assignment: %=

Comparing values in C

C can compare two values and/or variables against each other to return true or false. The operators are as follows:

  • Do both sides have the same value? ==
  • Do the two sides have different values? !=
  • Is the left side a lower value than the right side? <
  • Is the left side a lower or equal value to the right side? <=
  • Is the left side a greater value than the right side? >
  • Is the left side a greater or equal value to the right side? >=

Logical Operators in C

C can perform logical operations using the following operators:

  • and: && (Are both sides true?)
  • or: || (Is at least one side true?)
  • not: ! (True becomes false and false becomes true.)


This content originally appeared on DEV Community and was authored by Mirsolih Mirzaahmad õğli


Print Share Comment Cite Upload Translate Updates
APA

Mirsolih Mirzaahmad õğli | Sciencx (2022-03-17T16:45:01+00:00) Lesson 02. Retrieved from https://www.scien.cx/2022/03/17/lesson-02/

MLA
" » Lesson 02." Mirsolih Mirzaahmad õğli | Sciencx - Thursday March 17, 2022, https://www.scien.cx/2022/03/17/lesson-02/
HARVARD
Mirsolih Mirzaahmad õğli | Sciencx Thursday March 17, 2022 » Lesson 02., viewed ,<https://www.scien.cx/2022/03/17/lesson-02/>
VANCOUVER
Mirsolih Mirzaahmad õğli | Sciencx - » Lesson 02. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/03/17/lesson-02/
CHICAGO
" » Lesson 02." Mirsolih Mirzaahmad õğli | Sciencx - Accessed . https://www.scien.cx/2022/03/17/lesson-02/
IEEE
" » Lesson 02." Mirsolih Mirzaahmad õğli | Sciencx [Online]. Available: https://www.scien.cx/2022/03/17/lesson-02/. [Accessed: ]
rf:citation
» Lesson 02 | Mirsolih Mirzaahmad õğli | Sciencx | https://www.scien.cx/2022/03/17/lesson-02/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.