All pastes #1515934 Raw Edit

Miscellany

public text v1 · immutable
#1515934 ·published 2009-08-02 18:51 UTC
rendered paste body
extern printf, scanf

section .data
    b: dq 1.645
    msg_p: db 'Hoeveel is p: ', 0
    msg_q: db 'Hoeveel is q: ', 0
    msg_n: db 'Hoeveel is de nauwkeurigheid: ', 0
    msg_o: db 'De ideale steekproefgrootte is: %d', 10, 0
    scanint: db '%d', 0

section .bss
    p: resd 1
    q: resd 1
    n: resd 1
    f: resd 1

section .text
    global _start
_start:
    ; p inlezen
    push msg_p
    call printf
    add esp, 4
    push p
    push scanint
    call scanf
    add esp, 8

    ; q inlezen
    push msg_q
    call printf
    add esp, 4
    push q
    push scanint
    call scanf
    add esp, 8

    ; nauwkeurigheid inlezen
    push msg_n
    call printf
    add esp, 4
    push n
    push scanint
    call scanf
    add esp, 8

    ; formule uitrekenen
    mov eax, [n]
    mul dword [n]
    mov [n], eax
    fld qword [b]
    fmul qword [b]
    fimul dword [p]
    fimul dword [q]
    fidiv dword [n]
    fistp dword [f]

    ; resultaat weergeven
    push dword [f + 4]
    push dword [f]
    push msg_o
    call printf
    add esp, 12

    ; return 0
    mov eax, 1
    mov ebx, 0
    int 80h