Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 27

1

~C-Language

Project
(Practical File)

8y tshi Bumeed
D]C Abdu| nameed
DAL (CI1)
I|rst ear

2


RtBl BNtt
d/o
0l BNtt
t {0l1)
fitst Teut
Technology:
lf0RN1l0
College:
6et Nenetechnic lnstitute.
0tungi T
3

8# Practical Ob]ective Date 8ign
01 7e Ieor 7urbe-C regrommIg ewIremet.
02 7e prIt eur ome e tcree
03 7e ttudy tbree doto typet eI C Ioguoget
04 7e ttudy tbe ute eI Iermot tpecIIIertt
05 7e ttudy tbe ute eI Iermot tpecIIIert by utIg o worIobIet
06 7e mobe morbt tbeet eI exomt
07 7e decIore muItIpIe worIobIet od tbew tbem e tcreet
08
7e tobe oge eI o uter I yeort ot Iput od IId eut tbe
umber eI doyt t
09
wrIte o pregrom tbot tobet Iput Irem uter od dItpIoy e
tcree.
10 7e IId eut tbe percetoge eI morbt I exom by uter Iput.
11(a) wrIte o pregrom wbIcb utet IIeId tpecIIIert.
11(b) wrIte o pregrom wbIcb utet IIeId tpecIIIert.
11(c ) wrIte o pregrom wbIcb utet IIeId tpecIIIert.
12
wrIte o pregrom wbIcb ceutt tbe tetoI umber eI
cboroctert typed.
13
wrIte o pregrom wbIcb tobet uter Iput ot cboroctert od
Ier cborocter V It dItpIoyt o mettoge.
14 MedIIy tbe pregrom eI Iob#tz by utIg II-eIte cedItIe.
15
wrIte o pregrom te oweId uecettory repetItIe by utIg
Ier Ieep.
16
wrIte o pregrom tbot utet Ier Ieep od o IuctIe te prIt o
text I o bex.
17
wrIte o pregrom wbIcb co coIcuIote mIImum od
moxImum eI tbe twe umbert by pottIg porometert I
18
wrIte o pregrom wbIcb co coIcuIote IocterIoI eI o gIwe
umber.
19
wrIte o pregrom wbIcb tbewt ot dIIIeret IecotIet eI o
orroy.
20
wrIte o pregrom wbIcb tbewt ot dIIIeret IecotIet eI o
orroy.

4



3

Lab

Ub|ective:
1o leurn 1urbo-C Progrummlng envlronment.
eory:
Muln()
C rogram conslsLs of funcLlons Lhe maln() funcLlon ls Lhe one whlch conLrols ls passed when Lhe ls
execuLed
ode:

#lncludesLdloh //header flle
#lncludeconloh //header flle

vold maln(vold) //maln funcLlon

clrscr() //clear scree
prlnLf(Pello World)
geLche() //geL characLer wlLh echo walL

Practical Uutput:

Pello World

6

Lab

Ub|ective:
1o prlnt our nume on xcreen
eory:
1he prlnLf funcLlon ls a versaLlle and powerful funcLlon
yntax:
prlnLf( some sLrlng ")
ode:

#lncludesLdloh
#lncludeconloh

vold maln(vold)

clrscr()
prlnLf(Arshl Pameed")
geLche()

Practical Uutput:

Arshl Pameed

7

Lab

Ub|ective:
1o xtuJy three Jutu typex of C lunguuge:
ode:
#lncludesLdloh
#lncludeconloh

vold maln(vold)

clrscr()
lnL lnL1 //declarlng lnLeger varlable
char ch1 //declarlng characLer varlable
floaL fl1 //declarlng floaL varlable
//lnlLlallzlng varlables
lnL110
ch1g
fl101
//prlnLlng varlable values
prlnLf(value of lnL1 ls dnlnL1)
prlnLf(value of ch1 ls cnch1)
prlnLf(value of lnL1 ls fnfl1)
geLche()

Practical Uutput:


8

Lab

Ub|ective:
1o xtuJy the uxe of formut xpeclflerx:

ode:

#lncludesLdloh
#lncludeconloh

vold maln(vold)

clrscr()
prlnLf(1hls ls number d20)
geLche()


Practical Uutput:



9

Lab

Ub|ective:
1o xtuJy the uxe of formut xpeclflerx by uxlng u vurluble:

ode:

#lncludesLdloh
#lncludeconloh

vold maln(vold)

clrscr()
lnL a // varlable declaraLlon
a2

prlnLf(value of a ls da) //varlable call
prlnLf(nMy name ls s""Arshl")

geLche()

Practical Uutput:



10

Lab

Ub|ective:
1o muke murkx xheet of exum:

ode:
#lncludesLdloh
#lncludeconloh
vold maln(vold)

clrscr()
lnL maLhengurdulslamlaLsclence //declaraLlon of varlables

maLh70
eng60
urdu20
lslamlaL80
sclence90

prlnLf(MaLhdnLngllshdnurdudnlslamlaLdnSclencednmaLhengurdulslaml
aLsclence)
geLche()


Practical Uutput:


11

Lab

Ub|ective:
1o Jeclure multlple vurlublex unJ xhow them on xcreen:

ode:
#lncludesLdloh
#lncludeconloh
vold maln(vold)

clrscr()
lnL num1 num2
char opLlon1 opLlon2
floaL polnL1polnL2
num110
num220
opLlon1y
opLlon2n
polnL1202
polnL2302
prlnLf(CpLlon 1cnnumber 1 dnolnL 1fopLlon1num1polnL1)
prlnLf(nCpLlon 2cnnumber 2 dnolnL 2fopLlon2num2polnL2)
geLche()

Practical Uutput:


12

Lab 8

Ub|ective:
1o tuke uge of u uxer ln yeurx ux lnput unJ flnJ out the number of
Juyx :

ode:
#lncludesLdloh
#lncludeconloh

vold maln(vold)

clrscr()

floaL years days
prlnLf(lease Lype your age ln years)
scanf(fyears)
daysyears*363
prlnLf(?ou are 2f days old!ndays)

geLche()

Practical Uutput:



13

Lab 9

Ub|ective:
rlte u progrum thut tukex lnput from uxer unJ Jlxpluy on
xcreen.

ode:
#lncludesLdloh
#lncludeconloh

vold maln(vold)

clrscr()

lnL age
floaL helghL
char gender
prlnLf(1ype your age gender(m/f) and helghLn)
scanf(d c fagegenderhelghL)
prlnLf(?ou are d years old your helghL ls f feeL your gender ls cagehelghLgender)
geLche()


Practical Uutput:

14

Lab

Ub|ective:
1o flnJ out the percentuge of murkx ln exum by uxer lnput.
ode:
#lncludesLdloh
#lncludeconloh
vold maln(vold)

clrscr()
lnL cpaslslmaLhphy
floaL sum perc
prlnLf(LnLer marks of CompuLer rogrammlngn)
scanf(dcp)
prlnLf(LnLer marks of AppllcaLlon SofLwaren)
scanf(das)
prlnLf(LnLer marks of lslamlaLn)
scanf(dlsl)
prlnLf(LnLer marks of MaLhemaLlcsn)
scanf(dmaLh)
prlnLf(LnLer marks of hyslcsn)
scanf(dphy)
sumcp+as+lsl+maLh+phy
percsum*100/300
prlnLf(?our percenLage ls 2fperc)
geLche()


13

Practical Uutput:


16

Lab {a]

Ub|ective:
rlte u progrum whlch uxex flelJ xpeclflerx.

ode:
#lncludesLdloh
#lncludeconloh

vold maln(vold)

clrscr()

floaL evenL2723
prlnLf(evenL 2fnevenL)
prlnLf(evenL 1fnevenL)
prlnLf(evenL fevenL)
geLche()


Practical Uutput:



17

Lab {b]

Ub|ective:
rlte u progrum whlch uxex flelJ xpeclflerx.

ode:
#lncludesLdloh
#lncludeconloh

vold maln(vold)

clrscr()

floaL evenL2723
prlnLf(81f 81f 81fn301233233)
prlnLf(81f 81f 81fn30001200333003)
geLche()

Practical Uutput:



18

Lab {c]

Ub|ective:
rlte u progrum whlch uxex flelJ xpeclflerx.

ode:

#lncludesLdloh
#lncludeconloh
vold maln(vold)

clrscr()
floaL evenL2723
prlnLf(81f 81f 81fn301233233)
geLche()


Practical Uutput:



19

Lab

Ub|ective:
rlte u progrum whlch countx the totul number of churucterx
typeJ.
ode:

#lncludesLdloh
#lncludeconloh
vold maln(vold)

clrscr()

lnL charcnL0
lnL wordcnL0
char ch
prlnLf(1ype ln a phrase n)
whlle(chgeLche()!r)
charcnL++

prlnLf(1oLal characLers Lyped are dcharcnL)
geLche()


Practical Uutput:


20

Lab
Ub|ective:
rlte u progrum whlch tukex uxer lnput ux churucterx unJ for
churucter Y lt Jlxpluyx u mexxuge.
ode:

#lncludesLdloh
#lncludeconloh
vold maln(vold)

clrscr()
char ch
prlnLf(1ype any characLern)
chgeLche()
lf(ch?)

prlnLf(n?ou Lyped ?n)
prlnLf(?ou dld lLn)

prlnLf(n1ry agaln ( please)
geLche()

Practical Uutput:

21

Lab
Ub|ective:
MoJlfy the progrum of lub by uxlng lf-elxe conJltlon.
ode:
#lncludesLdloh
#lncludeconloh
vold maln(vold)

clrscr()
char ch
prlnLf(1ype any characLern)
chgeLche()
lf(ch?)

prlnLf(n?ou Lyped ?n)

else

prlnLf(n?ou dld noL Lype ?n)

geLche()

Practical Uutput:



22

Lab
Ub|ective:
rlte u progrum to uvolJ unnecexxury repetltlon by uxlng for
loop.
ode:
#lncludesLdloh
#lncludeconloh
vold maln(vold)

clrscr()
lnL l
for(l0l10l++)
prlnLf(nL CounL dl)
geLche()


Practical Uutput:



23

Lab
Ub|ective:
rlte u progrum thut uxex for loop unJ u functlon to prlnt u text
ln u box.
ode:
#lncludesLdloh
#lncludeconloh
vold llne(vold) // luncLlon proLoLype ls deflned here and semlcolon aL end
vold maln(vold)

clrscr()
llne() //luncLlon ls called
prlnLf(xu8lnLro Lo rogrammlngxu8n) // xu8 ls Lhe ASCll code for a box
llne()
geLche()

vold llne(vold) //luncLlon deflnlLlon

lnL l
for(l1l22l++)
prlnLf(xu8) //varlable l ls vlslble or known only Lo llne funcLlon
prlnLf(n)


Practical Uutput:


24

Lab
Ub|ective:
rlte u progrum whlch cun culculute mlnlmum unJ muxlmum of
the two numberx by puxxlng purumeterx ln functlonx.
ode:
#lncludesLdloh
#lncludeconloh
double mlnlmum(double a double b)
double maxlmum(double adouble b)

vold maln(vold)

clrscr()
prlnLf(Mlnlmum of 11 and 23 ls fnmlnlmum(11 23))
prlnLf(Maxlmum of 10 and 20 ls fmaxlmum(01 20))
geLche()

double mlnlmum(double a double b)

reLurn a b ? a b

double maxlmum(double adouble b)

reLurn a b ? a b

Practical Uutput:

23

Lab 8
Ub|ective:
rlte u progrum whlch cun culculute fuctorlul of u glven
number.
ode:
#lncludesLdloh
#lncludeconloh
lnL facLorlal(unslgned lnL number)

lf(number 1)
reLurn 1
reLurn number * facLorlal(number 1)

vold maln()

clrscr()
lnL x 3
prlnLf(facLorlal of d ls dxfacLorlal(x))
geLche()

Practical Uutput:


26

Lab 9
Ub|ective:
rlte u progrum whlch xhowx ut Jlfferent locutlonx of un urruy.
ode:
#lncludesLdloh
#lncludeconloh

vold maln(vold)

clrscr()
shorL age4 // array declaraLlon
age023 //array elemeLs lndex wlse asslgnmenL
age134
age263
age374

//prlnLlng array elemenLs

for(lnL l0 l4l++)

prlnLf(Age aL lndex d dnl agel)

geLche()

Practical Uutput:


27

Lab
Ub|ective:
rlte u progrum whlch xhowx ut Jlfferent locutlonx of un urruy.
ode:
#lncludesLdloh
#lncludeconloh
vold maln(vold)

clrscr()
shorL maL33l[

for(l 0 l 3 l++)
for([ 0 [ 3 [++)

maLl[ l*10 + [

prlnLf( lnlLlallzed daLa Lo )
for(l 0 l 3 l++)

prlnLf(n)
for([ 0 [ 3 [++)

prlnLf(32d maLl[)


geLche()

Practical Uutput:

You might also like