Dms Lab Sheet
Dms Lab Sheet
>1
In wate two sets
Obfect- White a phogram Co
nd peyotim the Unfon operaken on sets.
omd
Cocle-
#incude < Stdio.h>
tinclude <conio.h>
Scanf . d ",2a[l);
I1 taking input tor pecond set 8
hintf ("entr me size t set8-\n")
8canf "1d", an2);
he elemeuts of Bet 15
fintf (" Enlen
foy (i=0; i<n2, i++)
Scanf ("d", 4b0);
the vuion o set A and set
pant tov calulating
I/loqical Setc
he set A into
Copy
i+t)
for (i=o; icni;
can checked
elmeut is not
allowed, , Ao we
epeahing
any keraked
hen Nne value
not epeated
(f0jukf41)
( e i - b[i)
break;
Cjs=k)
cK]=bli];
Ktt
33
Pet A amd set B
bining uwon is - \n")
Union o set A ond get B
bunt"
or (i-o; i<k; itt)
5
6
Entor he size set B
4 B
enten he elemeut e t
3
6
Union of set A and Set B
23456
PROGRAM NO2
Coiect-wite o gr0 n G o ute ond
tus pet Omd
peor heinteurdm enaisn on ets.
Code
+tindude <tdin h
irdude <enin h
Vcid ncin
Output-
Enten the numben od
3et A
5
ge B
Enten he element
Enter ht
numbe o set B
4 element
set 8
o Set B
Enter he
stt A and
set B
Interpeckion ef
3u56
PROGRAM NO,>3
Oect
Cocle
+ incude <Stdio.h>
int main t)
foY= 0,izn1;f++)
foy(-o jtn2: jt)
(LL--alil)
bheak
T =na2)
bene w chetk thaut eltm eut aheady puwent
phusentF
1 in he set
ignou ft oBhenwipe add to tthe
present han
leience set
cA==a )
beak.;
CA=k)
=ni
heu
hou we check, that iy elemeud alwuady fusct in
/ pet-
othdwiae add to
phusen he ignone it
19
tt)
for (J=0; A<m;
4Cd)= =b[0)
break,
(=m)
m+t
33
t A-B is \ n");
Mintf" D!ecenct
uut f ("1.d",ciü);
3
Out pu
A4
Gnter eize
Det
Diteenct of A-B
2
B-A is-
bienence
5
19
PROGRAM NO4
Obiect
it (f=na)
for (=0; KKI+t)
breaks
Ktt
B-A
I/lopit fo ind
for (f=o, i<na; (+)
(d==bl])
beak
C=m)
dn]- bli1,
mtt
333
logic to Sy mpeie DivunCL
for (i=o iKK; +1)
Ntt
Y (i o, l<m ^ it+)
Sy nj =dli
is n");
uintf ("\n Smwektc Pienence q oet
tor(i=o,i<ng it+)
int ("d", syCi])3
ntwn
3
PROGRAM NO- 05
Obiect
Code
tinclucde <stdio.h>
incude Smath.h>
Void phintfowertet ( chy *set, int pet_size)
Code-
Hinclucle <Stdio.h
logic for OY gale
í find_OR Liut x, itY)
x l 4 y==1)
tcn 1;
i (X= =L 73yr=o) x==o 83 y==)
HetuHn LL
(X=0 4ye=o)
Htunm o
Hetum 1;
elpe
tetun 0
i CX==1)
hetuy O
else
etuhnl
Priver funcion
ut ch,a, b,
eiwtf("1. OR \7");
pintf "2, AND \n ")
Pntf ( "3. NOT \n ");
int ("4, exist\»')
wil ()
falefale \n*);
Scanf "y.d") aa);
Auntf C"yacl findNOr Co ))
break
Ce 4 eait (o)
olefault : Pintf (
"
wTOnG tey \n ")
PROOKAM NO
ebrt
11 include <4dio.h