Здесь Вы можете найти ответы на многие вопросы или задать свой вопрос!
#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; }
program xxx;
var i, j, k, min : integer;
a: array[1..10, 1..20] of integer;
b: array[1..10] of integer;
begin
for i: =1 to 10 do
for j: =1 to 20 do
readln(a[i,j]);
b[i]: =0;
b[i]: =b[i]+a[i,j];
end;
min: =b[1]; k: =1;
for i: =2 to 10 do
if b[i]< min then begin max: =b[i]; k: =i end;
writeln('наименьшая сумма элементов =', min);
writeln('она находится в строке -', k);
readln
end.
#include < cstdlib> #include < iostream> using namespace std; int main(int argc, char *argv[]){ int n; cout< < "введите количество элементов массива."< < endl; cin> > n; int mas1[n]; int mas2[n]; for(int i=0; i< n; i++){ mas1[i] = rand()%100; //заполняем массив случайными числами от 0 до 100 if(mas1[i]%10 == 4) { mas2[i]=mas1[i]/2; cout< < "замена! "; } else {cout< < "\t"; mas2[i]=mas1[i]; } cout< < mas1[i]< < '\t'< < mas2[i]< < endl; } system("pause"); return exit_success; }
Популярные вопросы