C programming theory Assignment 1
C programming theory Assignment 1
Variablec i
locatian in
A vCriahle,
memony that hold
ir a gqstogea
value that can
execution.
chanqe duing
Pngran
Eg' iat ag = 26
floatpne = lQ.5
Constanti A contant tat vave
CCunnot be changed
during
execuon paDyram
eg i- int MAX_AGE l00
Data Typer :
Deinec the tupe at
data Qvariable Can s tore
int foY fn teqex
float fox foatinq-
(eq i- S,l0, )
pint numberr
(314)
chax foy
egi-
haxactexc (eq :AE
Terna Engineering College, Nerul
Q2 xplata difexeat ia built libxony
funciaar
Built -in li bxam funcion are
prede tiae
funcianr
hat inCor
pextm otheg lanquaqei)
Soeitie tarkrond
specitic
Qre pa xt Ot astandaxd libray
Here are Sorme exanpler
(ud,&x
Sa yt0 Re humr the squae
otanumbex
Toot
ln C
charactexr
scape seguenes ar
cpecial
ued aide stingc Here'k
simple psugram demon thating
int main )
printf ("Hello, World! \n"
piatf" Thi irtabi t
a
netumO
Terna
Engineering College,Nerul
Q4)aqram to Aiad AlL
to 20 pime Numhet
<stdio h>
# ioclude
Void
int
naia
num
)
i flaq
brek
F= 0)
pintf(dnum)
Terna Engineering College,Nerul
pnat fl"dyi
Terna Engineering
College,Nerul
Q6) Difexene behween
Cal Reference
Call by Value Ž
conditioa ic checkedL
whileoop: The of te loop ic exc cuted
before the bod
falsefaitialythe
f tae condiian ic
not execut e atal
pMay
while (o oncitian,)
laop bady
looThecondithian ir
it checked
Ldo vohl
ahilz loop The loop
aftey ttae bady of the at
to execute
leastee
boady
d
do
oop bady,
íoile Condihan)
Q8 Acutal Paxametex fomal Paameka
Autal PaTamefer i The actuaalue oY
Vaxiablepassed to a tunchao ohen
it ir aled
Eg i- add l 3,4)-3 and 4 ane the
acutal paxamer
tonma pararmetex :The vaible ia the
functoodetini hoo thateceirer the
actua parame ter yalue
Egi- Noicd
are the
add Cint ayiotb)
foma
2La&b
paranag tea s
Lfunhon body
Terna Engineering College,Nerul
09 BecuxSive functan
SA neurie
ftelf
Calls
finchgiafunctian that
#include <stdiohs
int factona (iatn)
Cigt
Kelie (o
ehm n * factonal
int
piatf
m
cd
ain
("d ) tactorial 5)
Output ir 2O
QLo itferent Storoce Clascer
Auto iDefault ttorage clarfor local
variablec. Theae Variablc areCreated wtn
the functioa ic called and cdehnyed when
tne tuncton exitr
Registe riSpecitiec taat tae vaiable
Lshc
chould be stoe d io a cPu Yegiste Y
for faster accesr ( not qraaanteed)
Static :Betainc
behase en tuncháo
tecallwale ofavanable
and flooaart
#include <stdish>
# include cmatnih>
iat mcn (0
flaat Yadius
pnottl "'Eatka radiuci)
&xacdiuc)
ftouohort
Staxt
7tnputYatiur
fOrptoyaea
Exit
Terna Engineering College,Nerul
ct Ghea ambex
Program
g to Add Diqitc
(4so)
# include < stcia h
Int sum=
whileCnum )
Qutput 1241Rt0)
ttouotort
Stas t
fRepeatu tilo
Display Sum Exit