По разделам

 

Решение задачи Series 2


Даны десять вещественных чисел. Найти их произведение.

Код (C/C++)

#include <bits/stdc++.h>
using namespace std;

int main() {
	srand((int)time(0));
	int N = 10;
	cout << "N = " << N << endl;
	
	float p = 1.0;
	float x;
	for(int i = 0; i < N; i++) {
		x = rand() % 10 - 5;
		cout << x << " ";
		//cin >> x;
		p *= x;
	}
	
	cout << endl;
	cout << "Product = " << p << endl;

	return 0;
}

Код (Python)

import random

p = 1
for i in range(3):
    x = random.randrange(5)+1
    print(x, end="; ")
    p *= x
print()
print('Product = ', p)

p = 1
for i in range(10):
    x = random.uniform(1, 10)
    print(x)
    p *= x
print('Product = ', p)
									

Код (Pascal)

program Series2;
var
  R,Rez:Real;
  i:Integer;
begin
  Rez:=1;
  for i:=1 to 10 do
   begin
     Write('Введите ',i,' число: ');
     Readln(R);
     Rez:=Rez*R;
   end;
  Writeln(Rez);
end.
									




Series. Абрамян
Series 1 Просмотров: 4662
Series 2 Просмотров: 2400
Series 3 Просмотров: 2188
Series 4 Просмотров: 2364
Series 5 Просмотров: 2238
Series 6 Просмотров: 2854
Series 7 Просмотров: 3066
Series 8 Просмотров: 3386
Series 9 Просмотров: 2058
Series 10 Просмотров: 2502
Series 11 Просмотров: 1896
Series 12 Просмотров: 2269
Series 13 Просмотров: 1666
Series 14 Просмотров: 1577
Series 15 Просмотров: 1889
Series 16 Просмотров: 2289
Series 17 Просмотров: 2086
Series 18 Просмотров: 2933
Series 19 Просмотров: 2629
Series 20 Просмотров: 1667
Series 21 Просмотров: 1815
Series 22 Просмотров: 1802
Series 23 Просмотров: 2243
Series 24 Просмотров: 2021
Series 25 Просмотров: 1557
Series 26 Просмотров: 1416
Series 27 Просмотров: 1323
Series 28 Просмотров: 1278
Series 29 Просмотров: 1299
Series 30 Просмотров: 1334
Series 31 Просмотров: 1313
Series 32 Просмотров: 1853
Series 33 Просмотров: 1098
Series 34 Просмотров: 1148
Series 35 Просмотров: 1529
Series 36 Просмотров: 1627
Series 37 Просмотров: 1057
Series 38 Просмотров: 1384
Series 39 Просмотров: 996
Series 40 Просмотров: 1372

Комментарии

Чтобы написать комментарии вам нужно войти в систему или зарегистрироваться



Заявка на расчет