0% found this document useful (0 votes)
2 views

Dms Lab Sheet

Database management lab sheet

Uploaded by

rohityadava2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Dms Lab Sheet

Database management lab sheet

Uploaded by

rohityadava2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

PROGRAM NO.

>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>

int a[2, b[L0], c201,f, f, k=0,1, n2

ltakig nputfon fAinst set 4

intf (" ento the size q set A-In ");


Scanf ( ".d",4nL);
rintf (" Enten the elem ets set A-\n ");
fon (F-o; fani, i++)

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

the elemest oet B iuto pet ,


Cory
for (ir o ic; i)

(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)

intf ("44) cii);


getch C)
Tetwn 0
Ouput-
Ente the size s e t A-
5
A-
Ento he elemeut q pe

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

ird a [o, b[50], c[s0], ni, na, n,i, {, k=0


clsscr (,
taking nput 4 t A
Phin"nter me number q pet A-\n ");
Scon"1.d", an1)
fintf ("Eudeh he demeut d Det h'-\n")
forr Cio fen1 it+)
ScAnfl1d', 49[i);
II tatg input pet B
Pintt (" Enlen he numben set 8 -\n ");
Scanf C"1.d", 412);
fiutt (" Entr the elemend0et B- \n");
for (i 0 ikn2, i++)
Scanf (".d", 2bfil);
logical pant
for (ir o ; icni; i++)
for o iena; f)
i (aC]==bln)
c[K]=a[l
Kt+

get A omd t 6-\n");


huntt ("Intege chiom d

suintf ( ' , cE1);


getch )

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)

t aiol , bto), elioj dpo] ,m=o,K=o,nl ,n, 1,1,f:


Buintf (" Enter size ot set A ")
Scanf (".d", 4n1) ;
bintf enten elemeut o Set ")
for-0; ienu;f++)
Scant (1.d", 2a[]);
Pintf " enter size d set 8 )
SanC"y.d, n2);
Pintf" Entor element od 6tt "
frr (tro; fna; itt)
Scanf ("1.d", 2b[{]);
I1ogte for find A-B

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

tor (l=o, I<K; Itt)

cA==a )
beak.;

CA=k)

logit tor ind B-A


Itt)
tor (f 0 len
fovf-0 fend, jtt)
(bLO=alil)
break

=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ü);

Paintt (" \n "); \n"];


B-A i
of
uintf (" Dipenence
(i=o; fm; i4i)
for
Printt"1.4", dii);
netuin 0

3
Out pu
A4
Gnter eize
Det

Ente elemmeud ope


2 43
DoN.RAM NIN 4
t n t size pepet B4
Enter elemen" o att
35 6

Diteenct of A-B
2
B-A is-
bienence
5
19
PROGRAM NO4
Obiect

Cocde t fncluude <stdlio. h>


nt mcun D

,b[io),¢[io), d[ioj, m=o,n= 0, na, n2, , i


int aio]
1SyCuo
Buntf ("Ento size per A")5
Scanf1.d",Anu),
intf "Ento elemeut wet"
tor (1=0, inii+)}
ScanP(.d", a a[iD;
int"nten he size o et 6 ");
Scant .d", an2);
i n f F " Enter elemeut d pet");
for (i-0ien2; ít+)
scanf ".d", ab[i]);
togic To nd 4-B
for (fe 0 îeni 141)
in hu
hou we eheck that is bl1] alheady puwed
1 set it ohlwipeqdd it to he
prueut hen iqnotu
qns pet
for C=o[*n2;{tt
(blf=-a[11)

it (f=na)
for (=0; KKI+t)

breaks

Ktt

B-A
I/lopit fo ind
for (f=o, i<na; (+)

for (f=0; f4n1 jtt)


(bri]==q[f1)
bheak.
3
i-n)
Ku
phueut in He
phseutin
we check that is bli) alhuady
abuady
hore
a n s pet omenwiae
add it to lhe
phusent
hen igntha tt
I gns Set
for e o I<m , l+1)

(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)

petq pe wilh pet.size


n
/ actsize fouwch
a**n-i) */|
Unsigned nt pow_set_size= pow(2, oetsize)
int tounder, i
* Run foom Counte 000..0 to 1..1*/

tor lounter=0 ; ounten< Powsct_Sizej


couuto tt)

foY j=0 setsize, jtt)


is bet
/ Chek ik th bt in he couwtr
point 1thelemet from det */
p e hen
i Ccounten 4 (l«{)
Printf((".C SetT1);

anhf (" \»");

/*Praver program to tot pivt fovsehypet*7


n moun ()

chan setC) = {'a', b', '°};


int buoepet (set, 3):
Hctwn 0
PROGRAM NO. >6
Objec

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

ogic yr AND Gade


int findAND (int X,int y)

Hetum 1;
elpe
tetun 0

logio br find NOT


t find_NOTr CiwtX)

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 ()

BiutfC" n ende youn choicen ")


Sca nf " 1d'", Ach))
Switch Cch)

Case intfC "ive twoknput 1 r truu omd o Ar


falbe tn")
SCauf ("d v.d" 9, ab)
aintf ("y.d", Aind oR Ca,)
beak
intt ("aive two inpt 1 brtu and
CO
o foy falbe\n ");
Sconf ( d d", aq,8b);
intf ( ").d", findANDCb));
break
Cope3 rinti"Give gn input ! fy uuu cmd 0

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

iut 9LIo1, bloj, nJ, n2;


A\n"),
in f " fnken sire o et
enf ( "d", tns) pet A \n ")
huu f(" Edon elemed
of
f s (iut 0 fcnJ, i14)
scunfy.d") qal),
Puintf ("tudon ue e t B n ) ;
Scanf (" J.d", 8m) s \» ")
pindf" Fnlen ol cmunt e i
fov fut i-o i2n2; 11)
SranM "y.l 4b1);
for cotesian product
Itlgi
undf ( "S ");

Aor ivd i n 2 , fH)


),
i d C"(4d d) ",a), bil
frinsf(");
rcwm 0,

You might also like