You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Lesson_04
* Lesson_04
* Feat: Jason lesson_04 ReadMe
* chore: revert lesson_03 changes
Signed-off-by: Anthony D. Mays <[email protected]>
---------
Signed-off-by: Anthony D. Mays <[email protected]>
Co-authored-by: Anthony D. Mays <[email protected]>
This C program checks if a given nember is a prime number.It uses a function isPrime() to then determine whether a number is a prime number and the gives the output.
49
+
50
+
This C++ program checks when a given number is a prime number by using the simple function isPrime() and the gives an out. It does so by using the <iostream> which is a library for input/output and the <cmath> for calculation.
51
+
52
+
53
+
### DIFFERENCES
54
+
55
+
1.**Syntax**:
56
+
- In C it uses a standard input-output library which gives us the ability to use functions such as print() to give output.
57
+
- In C++ it uses a standard input-output stream library which makes us be able to use std::cout and std::endl to display the output.
58
+
59
+
2.**How they carry out calculation**:
60
+
- C uses the bool data type to which provides true and false values for logical operation whilst the C++ use a math library to do mathematical functions such as sqrt() that calculkates square root numbers.
61
+
62
+
63
+
64
+
### SIMILARITIES
65
+
66
+
1.**Codes**:
67
+
- Both C and C++ use the function if (n <= 1) return false to determine if the number is a prime number.
68
+
- They both have the ability to do loop for Checking Divisibility.
69
+
- the function return true; is use by both programs to return true if No Divisors found.
0 commit comments