﻿ Primitive Variables

# Primitive Variable Operations

## Note

All primitive-variable operations can be used in the same way when using variable names or literals (2, 2.0, etc.)

## Basic Mathematical Operations

This operation is written just like how you would expect it to be written.

• ` 1. 2. 3. 4. 5. 6. 7. 9. `
• ` #include <stdio.h> int main() { char ignoreThisVariableForNow; int a = 2 + 8; printf("%i", a); scanf_s(ignoreThisVariableForNow); return 0; } `

### Subtraction (-)

This operation is also written just like how you would expect it to be written.

• ` 1. 2. 3. 4. 5. 6. 7. 9. `
• ` #include <stdio.h> int main() { char ignoreThisVariableForNow; int a = 1287 - 1287; printf("%i", a); scanf_s(ignoreThisVariableForNow); return 0; } `

### Multiplication (*)

Multiplication is also written just like how you would expect it to be written.

• ` 1. 2. 3. 4. 5. 6. 7. 9. `
• ` #include <stdio.h> int main() { char ignoreThisVariableForNow; int a = 7 * 7; printf("%i", a); scanf_s(ignoreThisVariableForNow); return 0; } `

### Division (/)

Division is also written just like how you would expect it to be written.

• ` 1. 2. 3. 4. 5. 6. 7. 9. `
• ` #include <stdio.h> int main() { char ignoreThisVariableForNow; int a = 9 / 3; printf("%i", a); scanf_s(ignoreThisVariableForNow); return 0; } `

### Modulus (%)

The modulus symbol is written in between two value, like the four mathemtatical operators described above. Modulus calculates the remainder of the division between the variable on the left and the variable on the right.
NOTE: Modulus cannot be used on floating-point variables.

• ` 1. 2. 3. 4. 5. 6. 7. 9. `
• ` #include <stdio.h> int main() { char ignoreThisVariableForNow; int a = 9 / 3; printf("%i", a); scanf_s(ignoreThisVariableForNow); return 0; } `