Предмет: Информатика, автор: JohnCena99

Найти сумму положительных нечетных чисел, меньших 100.


JohnCena99: Нужен в ассемблере с вставкой с++
Типо того:

#include
#include
#include
#include

#include

using namespace std;


int main()
{
int summ = 0;
for (int i = 1; i < N; i+=2)
{
_asm
{
mov ebx, [i]
shl ebx, 2
lea esi, arr
add esi, ebx
lodsd
cmp eax, 100
ja _next
test eax, 0x80000000
jnz _next
test eax, 0x1
jnz _next
add summ, eax
_next:
}
}

cout << summ;
return 0;
}

Подробнее - на Znanija.com - https://znanija.com/task/35529815#readmore
elenasimenko3: 2500
JohnCena99: ты рофлишь? мне программа нужна, а не ответ

Ответы

Автор ответа: tatianarukhlova
0

var i,sum:integer;

begin

sum:=0;

for i:=1 to 100 do

if i mod 2 = 1 then sum:=sum+i;

writelnI(sum);

end.


JohnCena99: Нужен в ассемблере с вставкой с++
Типо того:

#include
#include
#include
#include

#include

using namespace std;


int main()
{
int summ = 0;
for (int i = 1; i < N; i+=2)
{
_asm
{
mov ebx, [i]
shl ebx, 2
lea esi, arr
add esi, ebx
lodsd
cmp eax, 100
ja _next
test eax, 0x80000000
jnz _next
test eax, 0x1
jnz _next
add summ, eax
_next:
}
}

cout << summ;
return 0;
}
tatianarukhlova: я откуда знала ?
Автор ответа: QIRR
0

Ответ:

program gg;

uses crt;

var

  a:array[1..10] of integer;

  sum,i:integer;

begin

clrscr;

 writeln('vvedite 4isla');

 for i:=1 to 10 do

 readln(a[i]);

 for i:=1 to 10 do

 if (a[i]>0) and (a[i] mod 2 <>0) and (a[i]<100)

 then begin

      sum:=sum+a[i];

      end;

 writeln('summa: ',sum);

 readln;

 end.

Объяснение:


JohnCena99: Нужен в ассемблере с вставкой с++
Типо того:

#include
#include
#include
#include

#include

using namespace std;


int main()
{
int summ = 0;
for (int i = 1; i < N; i+=2)
{
_asm
{
mov ebx, [i]
shl ebx, 2
lea esi, arr
add esi, ebx
lodsd
cmp eax, 100
ja _next
test eax, 0x80000000
jnz _next
test eax, 0x1
jnz _next
add summ, eax
_next:
}
}

cout << summ;
return 0;
}

Подробнее - на Znanija.com - https://znanija.com/task/35529815#readmore
Интересные вопросы