CSCI 10 Lecture Notes - Lecture 6: Divisor
Document Summary
All homework, slides and code examples are on michaeljbannister. com. Problem 2: write a program that can determine if a given number is prime. 0 is not prime: write a program that prints all primes below 1000. For (int f = 2; f < n; f++) { Count++: write a program that prints the first 1000 primes. Problem 3: write a program to print a given number in binary. (for now we will settle with printing it backwards) 1 / 2 = 0 for (int k = n; k > 0; k= k/ 2 or k/=2) cout << k % 2; Problem 4: write a program to compute the greatest common divisor of two numbers. (there are many ways to do this! Strive for the simplest!) int n, m = 0; cout << prompt cin >> for (int i = n; i > n) *refactoring re-designing a working program to make it better.