Common Computer Science References
A Boolean expression is also the heart of looping and gives your program the ability to do things over and over again.
Below is a list of possible problems that MUST be solved using some kind of looping structure. You need to pick one, that no one else in the class has selected and solve this problem for the assignment. Do not wait until the last minute. Once again your program IS NOT ALLOWED TO CRASH, no matter what the user enters as input. Also NO USING built in functions like max or min.
If you are not sure of any part of the problem, just ask me and I will give you additional information.
No using any built in functions to solve your core problem. You MUST use looping to solve your problem.
I can get a bonus? Yes, you can!
If you complete just the above part of the assignment in Python, you will be marked out of 3+. You will be marked out of 4+ if you do the programming in C++ as well.
Come up with your own question that uses a looping structure. Let me know what it is in advance and if I approve of it, you can then use it. π
Write a program that prompts the user to input a positive integer. It should then print the multiplication table of that number (0 to 10).
Two numbers are entered. Write a program to find the value of one number raised to the power of another. (Do not use any built-in method, you must use a loop.)
Write a program that prompts the user to input an integer and then outputs the number with the digits reversed.
For example, if the input is 12345, the output should be 54321.
Write a program that reads a set of integers, and then prints the sum of the even and odd integers.
Write a program to calculate HCF (GCD) of two given number.
Write a program to calculate LCM of two given number.
Write a program to enter the numbers until the user wants to end, it should then display the count of positive, negative and zeros entered.
Write a program to enter the numbers until the user wants to end, it should then display the largest and smallest numbers entered.
Write a program to calculate the sum of following series where n is input by user: 1 + 1/2 + 1/3 + 1/4 + 1/5 +β¦β¦β¦β¦1/n
Compute the natural logarithm of 2, by adding up to n terms in the series: 1 - 1/2 + 1/3 - 1/4 + 1/5 -... 1/n , where n is a positive integer and input by user.
Write a program to compute sin(x) for given x. The user should supply x and a positive integer n. We compute the sine of x using the series and the computation should use all terms in the series up through the term involving xn sin x = x - x3/3! + x5/5! - x7/7! + x9/9! .......
Write a program to compute the cosine of x. The user should supply x and a positive integer n. We compute the cosine of x using the series and the computation should use all terms in the series up through the term involving xn cos x = 1 - x2/2! + x4/4! - x6/6! .....
Given a string and a non-negative integer n, return a larger string that is n copies of the original string. Ex
string_times('Hi', 2) β 'HiHi'
string_times('Hi', 3) β 'HiHiHi'
string_times('Hi', 1) β 'Hi'
Given a string and a non-negative int n and m is the front of the string of chars. Return n copies of the front m;
front_times('Chocolate', 2, 3) β 'ChoCho'
front_times('Chocolate', 3, 5) β 'ChocoChocoChoco'
front_times('Abc', 3, 3) β 'AbcAbcAbc'
Write a simulation that rolls 2 dice over and over again until you get doubles. Show each roll (on 1 line) and state how many time it happened until you got doubles. For your 3 test cases, run the simulation 3 times. Bonus: nest your code in a loop and find out the percentage chance of rolling doubles!
Use nested loops to print out the 0-9 multiplication tables, like in elementary school.
Use nested loops to generate a list of all the pairs of positive two digit numbers whose sum is 60, and whose difference is 14.
Use nested loops to find four positive integers whose sum is 45, and such that the first plus 2, the second minus 2, the third multiplied by 2, and the fourth divided by 2 are all equal.
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. (for test cases start with 10, 15, 20, then just assume it will work for 1000)
Write a program to input a number from a user and find all factors of the given number using for loop.
Write a program that generates all the prime numbers up to the value given by the user.
Write a program that generates all the "Yellowstone Permutations" up to the value given by the user.
Write a program that generates all the Fibonacci sequence numbers up to the value given by the user; no recursion.
Write a program that generates all the Tribonacci sequence numbers up to the value given by the user; no recursion.
Write a program that generates all the Tetranacci sequence numbers up to the value given by the user; no recursion.
Write a program where the user enters a whole number and then it generates that many "Recaman's sequence" values, in order.
Write a program where the user enters a whole number and then it generates that many "Catalan Numbers" values, in order.
Write a program where the user enters a whole number and then it generates that many "Lucas Numbers" values, in order.
Write a program where the user enters a whole number and then it generates that many "Numbers that are not squares", in order.
Write a program that generates the "Odious numbers", in order; assume 8-bits and you are using unsigned numbers, so 0 to 255.