#include < stdio.h> #include < stdlib.h> #include < conio.h> #include < math.h> int main(){ int x, y; printf("\n vvedite x and y: "); scanf("%d" "%d", & x, & y); if (x < y) printf("\n x = %d, y = %d", (x + y)/2, 2 * x * y); else printf("\n x = %d, y = %d", 2 * x * y, (x + y)/2); printf("\n\n to "); getch( ); return 0; }
Ответ дал: Гость
смотри блок-схему в приложенном файле
Ответ дал: Гость
прогоняем числа от 10 до 99 в цикле, учитываем при выводе отрицательные числа.
на tpascal:
var i: integer;
begin
for i: =10 to 99 do begin
if i mod 3 = 2 then
writeln (i,' ',-i,' ');
i: =i+1;
end;
readln
end.
Ответ дал: Гость
program prim2; uses crt; var i, n, r: integer; a: array[1.. 10000] of integer; begin clrscr; randomize; write ('число элементов '); readln(n); for i: =1 to n do begin {получаем случайные числа и выводим их на экран.} a[i]: =random(45)-22; write(a[i],' '); end; {в полученном массиве меняем соседние элементы.} i: =1; {пока i< =n-1.} while i< =n-1 do begin {меняем значения соседних элементов. } r: =a[i]; a[i]: =a[i+1]; a[i+1]: =r; {увеличиваем индекс на два.} inc(i,2); end; {распечатываем измененный массив.} for i: =1 to n do write(a[i],' '); readkey; end.
Популярные вопросы