Below is an example using DOS interrupts in 8086 assembly language to take input and display output.
; Define data segment
data segment
studentName db "John Doe",0
degreeName db "Computer Science",0
creditsTaken dw 120
creditsRequired dw 180
creditsToGraduate dw 0 ; Store the calculated credits to graduate
data ends
; Define code segment
code segment
start:
; Print student name
mov dx, offset studentName
mov ah, 9h
int 21h
; Print degree name
mov dx, offset degreeName
mov ah, 9h
int 21h
; Print number of credits taken
mov dx, offset creditsTaken
mov ah, 9h
int 21h
; Print credits required
mov dx, offset creditsRequired
mov ah, 9h
int 21h
; Calculate credits to graduate
mov eax, creditsRequired
mov ebx, creditsTaken
sub eax, ebx
mov creditsToGraduate, eax
; Print credits to graduate
mov dx, offset creditsToGraduate
mov ah, 9h
int 21h
; Exit program
mov ah, 4ch
int 21h
code ends
end start
So, the above data segment contains variables such as student name, degree name, credits taken, credits required, and credits to graduate.
The code segment contains executable instructions. The start label marks the beginning of the program's code.