Question: 2 1. Write a program to find out (the hard way, by counting them) how many of the numbers from 1 to 10 are greater

2  2 1. Write a program to find out (the hard way,

1. Write a program to find out (the hard way, by counting them) how many of the numbers from 1 to 10 are greater than 3. (The answer, of course, should be 7) Your program should have a loop which steps a variable (probably named i) over the 10 numbers. Inside the loop, if i is greater than 3, add one to a second variable which keeps track of the count. At the end of the program, after the loop has finished, print out the count. 2. a) Write a program to print the numbers from 1 to 10 and their squares 10 100 b) Write a program to compute the average of the ten numbers 1, 4, 9,... 81, 100, that is, the average of the squares of the numbers from 1 to 10. (This will be a simple modification of Exercise 2a: instead of printing each square as it is computed, add it in to a varable sum which keeps track of the sum of all the squares, and then at the end, divide the sum variable by the number of numbers summed.) 3. Write a program to print the first 10 Fibonacci numbers. Each Fibonacci number is the sum of the two preceding ones. The sequence starts out 0, 1. 1,2.3, 5,8 4. Write a program that asks the user to enter a U.S, dollar amount and then shows how to pay that amount using the smallest number of $20, $10. S5, and SI bills: Enter a dollar amount: 93 $20 bills: 4 $10 bills: 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!