Professional Documents
Culture Documents
include irvine32.inc
.data
s1 byte "first five numbers are:",0,0ah
s2 byte " sum of first five numbers are:",0,0ah
n1 dd 5
sum dd ?
.code
main proc
TASK 2
include irvine32.inc
.data
s1 byte "first five numbers are:",0,0ah
s2 byte " = ",0,0ah
n1 dd 5
.code
main proc
TASK 3
include irvine32.inc
.data
s1 byte "enter the number :", 0 , 0ah
s2 byte "factorial :", 0 , 0ah
.code
main proc
mov edx , offset s1 ; asking for number
call writestring
call readdec ; getting number
mov ebx , eax ; moving number to ebx
mov ecx , 1
mov eax , 1
.while (ecx <= ebx) ;loop until ecx is smaller then the number user input
TASK 4
include irvine32.inc
.data
s1 byte "enter the number greater than 10",0,0ah
s2 byte " number is less than 10",0,0ah
s3 byte " sum offset even numbers:",0,0ah
s4 byte " sum offset odd numbers:",0,0ah
s5 byte "odd:",0,0ah
s6 byte "even:",0,0ah
n1 dd ?
sum dd 0
sum2 dd 0
.code
main proc
.while ( ecx >= edi); ; loop until entered num is greater then edi
mov eax , edi
mov edx , 0
div ebx ; diviser eax has dividend performing division
.else
mov edx ,offset s2 ; if number is not greater then 10 print this string
call writestring
.endif
exit
main endp
end
TASK 11
include irvine32.inc
.data
s1 byte "*",0
column dd 1
.code
main proc
mov ecx , 5 ; for outer loop
.while (column <= ecx ) ;loop until col is less or equal to ecx
.endw
call crlf ; moving code flow to next line in output
exit
main endp
end
TASK 12
; same as task 11 accept in while condition we replace ecx with 5
include irvine32.inc
.data
s1 byte "*",0
column dd 1
.code
main proc
mov ecx , 5
outer:
mov column , 1
call writestring
inc column
.endw
call crlf
loopnz outer
exit
main endp
end
TASK 10
include irvine32.inc
.data
.code
main proc
mov ecx , 5
mov eax , 1
outer: ; lable for outer loop
mov eax, 1
.while (eax <= ecx) ; loop until eax is less then then or equal to ecx
.endw
call crlf
call crlf
exit
main endp
end
TASK 7
include irvine32.inc
.data
s1 byte "Enter number:",0
s2 byte "Enter power:",0
n1 dd ?
n2 dd ?
.code
main proc
mov edx , offset s1; asking for number
call writestring
call reading ; getiing number
mov n1 , eax ; mov to n1