top of page

TITLE Program Template     (template.asm)

; kullanıcı 5 sayı girer.eğer 10<input<30 ise sayıları toplarız

; Author:
; Date Created:
; Last Modification Date:

INCLUDE Irvine32.inc
factorial proto ,mynum:dword
; (insert symbol definitions here)

.data

randomNumber dword 0
str1 byte "Uretilen sayi: ",0
str2 byte "2*N!+10= ",0
str3 byte "4*N!-30=",0


; (insert variables here)

.code
main PROC

call randomize
mov ecx,3

l1:
    mov ebx,1
    mov eax,10
    call randomrange
    mov randomNumber,eax
    mov edx,offset str1
    call writestring
    mov eax,randomNumber
    call writeint
    call crlf
    mov ebx,eax
    shr ebx,1
    jc tek
    jmp cont
        
tek:
    push ecx
    invoke factorial ,randomNumber
    pop ecx
    mov edx,offset str3
    call writestring
    shl eax,2
    sub eax,30
    call writeint
    
cont:
    push ecx
    invoke factorial ,randomNumber
    pop ecx
    mov edx,offset str2
    call writestring
    shl eax,1
    add eax,10
    call writeint
    
loop l1

finish:

; (insert executable instructions here)

    exit    ; exit to operating system
main ENDP

factorial proc ,mynum:dword

mov ecx,mynum
mov eax,1

l2:
    mul mynum
    dec mynum
loop l2

ret

factorial endp
; (insert additional procedures here)

END main

bottom of page