EXPERIMENT NUMBER 13
EXPERIMENT NUMBER 13
TITLE :
Write mixed language program to separate even and odd numbers from an array .
Theory:
Assembly Language can be Written in C .
C Supports Assembly as well as Higher Language Features so called “Middle Level Language”.
“asm” Keyword is written to indicate that “next followed instruction is from Assembly
Language”.
Many programmers are more comfortable writing in C, and for good reason: C is a mid-level
language (in comparison to Assembly, which is a low-level language), and spares the
programmers some of the details of the actual implementation.
However, there are some low-level tasks that either can be better implemented in assembly, or
can only be implemented in assembly language. Also, it is frequently useful for the programmer
to look at the assembly output of the C compiler, and hand-edit, or hand optimize the assembly
code in ways that the compiler cannot. Assembly is also useful for time-critical or real-time
processes, because unlike with high-level languages, there is no ambiguity about how the code
will be compiled. The timing can be strictly controlled, which is useful for writing simple device
drivers.
In c , every integer will take 2 bytes therefore for accessing any element using from array
assembly pointer should increment and decrement by 2.
Algorithm :
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
Void main( )
int arr[10],evn[10],odd[10];
int no ;
char rem
clrscr( )
asm div bl
if (rem=1)
odd{j]=no;
j++ ;
l1=j;
else
evn[k]=no;
K++;
l2=k;
printf (“%d”,evn[i]);
printf (“%d”,odd[i]);
getch( );
CONCLUSION: Program executed to separate even and odd numbers from an array and
output is verified.