2.2.5 Arithmetic Operations on Integers

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/7

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

8 Terms

1
New cards

What are the basic arithmetic operators in C?

+ (addition), - (subtraction), * (multiplication), / (division), % (modulus).

2
New cards

What is the difference of 5 - 3 in C?What is the sum of 5 + 3 in C?

8

3
New cards

What is the difference of 5 - 3 in C?

2

4
New cards

What is the product of 5 * 3 in C?

15

5
New cards

What is the quotient of 5 / 3 in C?

1

6
New cards

What is the remainder of 5 % 3 in C?

2

7
New cards

Why does 5 / 3 return 1 instead of 1.67 in C?

Because both 5 and 3 are integers, and integer division in C truncates the decimal part.

8
New cards

What will happen if we change int a = 5, b = 3; to float a = 5, b = 3; and use /?

The division will return 1.666667 because floating-point division preserves decimals.