You are on page 1of 2

---------------------------------------------------------------------

Practcal No.: 5
Title: Write a program to perform string operation.
Roll No.: 101
Date:
---------------------------------------------------------------------
Program code:
.model small
intr macro num
mov ah,num
int 21h
endm
.data
max db 80
actual db 0
string db 80 dup(0)
m1 db 10,13, "Enter the string:$"
m2 db 10,13, "Length of the string is:$"
m3 db 10,13, "Reverse of the string:$"
.code
mov ax,@data ;Data Segment Initialization
mov ds,ax
lea dx,m1 ;Display Message
intr 09h
lea dx,max ;Accept String
intr 0Ah
lea dx,m2 ;Display Message
intr 09h
mov dl,actual ;Display Length Of String
add dl,30h
intr 02h
lea dx,m3 ;Display Message
intr 09h
mov cl,actual
xor ch,ch
lea bx,string
add bx,cx
back1:dec bx
mov dl,[bx]
intr 02h ;Display reverse Of The String
dec cl
jnz back1
intr 4ch
end

OUTPUT:
C:\tasm>str.exe
Enter the string: Prasad
Length of the string is:7
Reverse of the string:dasarP

You might also like