Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

No.1
image text in transcribed
Problems: 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, ifi 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 I 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 variable 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 Fibonaci numbers. Each Fibonacci number is the sum The sequence starts out 0, 1,1, 2, 3, 5, 8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions