Download LAB_1_IS_15_07

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Elementary mathematics wikipedia , lookup

Transcript
1.
Write a program that asks a user to input an integer n. The program should
output the table of squares of numbers from 1 to n.
No. INPUT
OUTPUT
1
1
1. 3
2
4
3
9
2.
10
1
2
3
4
5
6
7
8
9
10
1
4
9
16
25
36
49
64
81
100
2.
Write a program that asks a user to input integers. The program stops reading
integers when the user inputs 0. The program should output number of the inputted
integers and the average.
No. INPUT
OUTPUT
3
1. 3 8 9 0
6.67
2.
10 45 87 34 12 0
5
37.6
3.
Write a program that prompts the user to integers. The program stops reading
integers when the user inputs 0. The program should output the maximum elements
among inputted numbers
No. INPUT
OUTPUT
3
1. 1 2 3 0
2.
3 17 8 9 0
17
4.
Write a program that prompts the user to an integer n. Then the program
should output the sum of the first n elements of the sequence 1, 3, 5, 7...
No. INPUT
OUTPUT
9
1. 3
2.
15
225
5.
Write a program that prompts the user to an integers a and b. Then the program
should output the table of power of an where n takes values from 0 to b.
No. INPUT
OUTPUT
0
1
1. 7 2
1
7
2
49
2.
2 10
0
1
2
3
4
5
6
7
8
9
10
1
2
4
8
16
32
64
128
256
512
1024