Download LAB_2_IS_15_06

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

Addition wikipedia , lookup

Halting problem wikipedia , lookup

Elementary mathematics wikipedia , lookup

Transcript
1.
Write a program that asks a user to input an integer n. The
program should output the table below.
2.
No. INPUT
1.
2.
3
7
OUTPUT
N
N*10
N*100
1
10
100
2
20
200
3
30
300
N
N*10
N*100
1
10
100
2
20
200
3
30
300
4
40
400
5
50
500
6
60
600
7
70
700
2.
Write a program that asks a user to input integers. The program
should stop reading numbers when the user inputs 0. The program should
output the arithmetic and geometric mean of inputted integers. The
geometric mean is defined as the nth root of the product of n numbers.
No. INPUT
OUTPUT
1.
2 8 9 0
6.33333 5.24148
2.
6 13 5 4 3 0
6.2 5.42062
3.
Write a program that asks a user to input numbers. The program
should stop reading numbers when the user inputs 0. The program should
output the maximum and minimum elements among inputted numbers.
No. INPUT
OUTPUT
1.
3.2 4.5 1.2 0
4.5 1.2
2.
0.3 -1.5 8.9 0.44 0
8.9 -1.5
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: 2 –
4+ 6 – 8+ 10 – 12 ...
No. INPUT
OUTPUT
1.
1
2
2.
3
4
3.
15
16
5.
Write a program that prompts the user to an integers a in binary
format. Then the program should convert inputted number into decimal.
No. INPUT
OUTPUT
1.
101
5
2.
01101
13