Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to count the number of +ve ( positive ) and _ve ( negative ) numbers

Posted By: Amber Hughes     Category: Assembly Language     Views: 6335

Write a program to count the number of +ve ( positive ) and _ve ( negative ) numbers.

Code for Program to count the number of +ve ( positive ) and _ve ( negative ) numbers in Assembly Language

data segment
        num db -3,1,-5,6,-7,9,'#'
        p_cnt db 0h
        n_cnt db 0h

data ends


code segment
        assume ds:data,cs:code

start:
        mov ax,data
        mov ds,ax

        lea si,num
main:
        cmp num[si],0h
        jg pos
        inc si
        add n_cnt,01h
        cmp num[si],'#'
        je exit
        jmp main

pos:
        add p_cnt,01h
        inc si
        cmp num[si],'#'
        je exit
        jmp main

exit:
        mov bl,p_cnt
        mov cl,n_cnt

        mov ax,4c00h
        int 21h

code ends
        end start
  
Share: 



Amber Hughes
Amber Hughes author of Program to count the number of +ve ( positive ) and _ve ( negative ) numbers is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!