М
Молодежь
К
Компьютеры-и-электроника
Д
Дом-и-сад
С
Стиль-и-уход-за-собой
П
Праздники-и-традиции
Т
Транспорт
П
Путешествия
С
Семейная-жизнь
Ф
Философия-и-религия
Б
Без категории
М
Мир-работы
Х
Хобби-и-рукоделие
И
Искусство-и-развлечения
В
Взаимоотношения
З
Здоровье
К
Кулинария-и-гостеприимство
Ф
Финансы-и-бизнес
П
Питомцы-и-животные
О
Образование
О
Образование-и-коммуникации
милан64488
милан64488
09.09.2020 00:31 •  Информатика

1) написать программу для нахождения периметра треугольника, если стороны вещественные числа. 2) написать программу для вычисления суммы и произведения двух произвольных чисел.

👇
Ответ:
07Лизочек07
07Лизочек07
09.09.2020
1)
var a,b,c:real;
begin
write('Введите три стороны треугольника: ');
readln(a,b,c);
if((a < b+c) and (b < a+c) and (c < a+b)) then write('Периметр треугольника: ',(a+b+c):9:3)
else write('Треугольник с данным сторонами не существует');
end.

2)
var a,b:real;
begin
write('Введите два числа: ');
readln(a,b);
writeln('Сумма данных чисел: ',(a+b):9:3);
write('Произведение данных чисел: ',(a*b):9:3);
end.
4,6(44 оценок)
Открыть все ответы
Ответ:
masloshick
masloshick
09.09.2020
Romanf romanf отличник 2013-01-10t16: 13: 22+00: 00 1. подумать над алгоритмом 2. вот сам алгоритм: а. спросить у пользователя значения б. расчитать ответ в. выдать ответ на экран 3. написать код в паскале 4. исправить ошибки компиляции 5. протестировать, вводить разные числа 6. обнаружила, что если вводить числа наугад ответ получается отрицательным иногда 7. вставить код проверки введенных пользователем значений 8. убрать ошибки компиляции 9. протестировать 10. готово а вот и сама программа: program aerobus; uses crt; const totalplace = 160; var businessplaces, economyplaces: integer; businessprice, economyprice: real; totalcharge: real; a,b: integer; correctinput: boolean; begin clrscr; businessplaces: =totalplace div 4; economyplaces: = totalplace - businessplaces; writeln('business places count: ', businessplaces); writeln('economy places count: ', economyplaces); correctinput: =false; while not correctinput do begin write('please input business class ticket price: '); readln(businessprice); if(businessprice> 0) then begin correctinput: =true; end else begin writeln('the price should be a positive number, please try again'); end; end; economyprice: =businessprice/2; writeln('economy ticket price is: ', economyprice: 0: 2); correctinput: =false; while not correctinput do begin write('how many business tickets are left? : '); readln(a); if(a> =0) and (a< =businessplaces)then correctinput: =true; if(a< 0) then begin writeln('please input a positive number or 0, please try again'); end; if(a> businessplaces) then begin writeln('please input a number which is less or equal to the tolal business place count, please try again'); end; end; correctinput: =false; while not correctinput do begin write('how many economy tickets are left? : '); readln(b); if(b> =0) and (b< =economyplaces)then correctinput: =true; if(b< 0) then begin writeln('please input a positive number or 0, please try again'); end; if(b> economyplaces) then begin writeln('please input a number which is less or equal to the tolal economy place count, please try again'); end; end; totalcharge: =(businessplaces-a)*businessprice; totalcharge: =totalcharge+(economyplaces-b)*economyprice; writeln('the total charge is: ', totalcharge: 0: 2); writeln; writeln('press enter to exit'); readln; end.
4,6(13 оценок)
Ответ:
nastiaalecko00
nastiaalecko00
09.09.2020
Var
    a: array [,] of integer;

begin
    var n := ReadlnInteger('n = ');
    var m := ReadlnInteger('m = ');
    var rand := ReadlnInteger('Для ручного ввода нажмите 0');
    
    if rand = 0 then begin
        a := new integer[m, n];
        for var i := 0 to m-1 do
            for var j := 0 to n-1 do
                a[i, j] := ReadlnInteger('a[' + i + ',' + j + '] = ');
    end
    else a := MatrixRandom(m, n, 1, 100);
    Println(a);
    
    var b := ArrGen(n, x -> 1);
    for var i := 0 to m-1 do
        for var j := 0 to n-1 do
            if j mod 2 = 0 then
                b[j] := b[j] * a[i, j];
    
    b.Where((x, i)-> i mod 2 = 0).SortedDescending().Println();
end.
4,5(74 оценок)
Новые ответы от MOGZ: Информатика
logo
Вход Регистрация
Что ты хочешь узнать?
Спроси Mozg
Открыть лучший ответ