Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
19 views
C Programming
C program lab
Uploaded by
Manikanta
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save c programming For Later
Download
Save
Save c programming For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
19 views
C Programming
C program lab
Uploaded by
Manikanta
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save c programming For Later
Carousel Previous
Carousel Next
Save
Save c programming For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 42
Search
Fullscreen
C- Languge + Used to communicate Lith then, Language is +. ge ins Huctoy. that means ox are giving 40 do certaih work: computen language with Compaten- Computer is a Softwave ©>) Predefines langtige having Sek of ProgYams + ig Used 40 Comrreetinicgs, Ned ie _Coopiateat language « User For Complex pyro blems Solving TF a Person Communicate with compute we meed 40 Comm unicat coith com putes Understandle lahguage that is binaay language (totter). “The compiley ae P | Con Verks asten bly lan guage into binayy language &Y Machine (arguage: Progryam + Sek of in styactions +compiley iS a predefined program (oi SoFEwaye + : Machines makes OU tacks casih; 5 i a c language is a &tuctared language Intevfate + et rf you wank +o Connect cvith Machines You ‘don't be a 10g Va mm er) + Ex! you wank +o withdyaw money fom ATM: - ‘ tr terface is Yothing bak ah applica hon Rey ver) Progra mimes l, Develops. -- applicationsTypes of applications + web- applications Standalone must be installed uotthouk ‘stalling in oun computer we Can Use them ¢ table for pila ie Independent of Single Operating . fi . System Operating System t ee VLE» m-sofFice, _ Youn cn chrome + Groogla» Com Oral: com Eile ertensions > ) abe . tak —x—+,VLc xyz 4 m pi’ 9 == Amott pad Opererting sustem ~ Extensions Winclows —>» vee Mac. —_r dmg Linux ——> . 1pm, * tan{n 0% Applicerttons clesay epencher| C operallrg syle): Programming language 4 CL plabl foun depriclent cay d L “Tow ble 10% eurlep Standalone gong one ele dle ! 6 ehylon } f Erernclione Opps { Of “rich : trulallation — Oreltold) Plat for indeyrtenl langue , is toorrlaton : a [orf uae car, develop both Standalone carr4 ‘Useb- Oppar Cl ctr osu “nourdlay ¢ Used fox crnbeded 44 ctor Proyiommni ng end C+t ic used for qerroing application, Th c++ hos bigheck library {or qacrning: plat fown ° de pendency in €y Windows > C+ ele mac ce drag 7 eT windows = Crete compilyy +Cibroy a ~ mac =) codmng = compilert libraryCompiley wor king fon pect (ic Operating system ~ Compiley conver ts Source Cocke ino Machin code+ In which platform We Compit, the language in that Plat for only we “Can Yun Vaviablu. - rremovy locertion syntax rf [|e Cater ty pe Identifier; Ex; links ap “are lop | hn RLY pyinEC a); Named memory location’ ic Called verviccte, “Seti ngs iden ties +0 rnemomy loca Hon by which We Can Process information eFfec tively ‘Functions © methocls + Sybtaxs Tdenti€y ( arguement = list) 5 b input a prectsting. in put s netuin — ty Pe outpat block oF instuc tions having identity ig Manda toy: add C int x, inEy) tht Z = ¥tys 4 cw Teta 3 5 YI HS ‘doing ‘Sométasks thak ‘mean You ore. feinctioning , Program + Function definition , Function call Remote controle,Functions in € | Is No Avguoments § No. nretom, values Void fun ( votd ) fun): ; a» with arguamen fs € NO return Values. Void fun (ink x) | Ui k 5 fun (10); \ | 3) with arguemebts and retain valas; | ints fun ( chay re) actuary 133 ry ink X=! Luo C9 '); ’Me No aagutrachl¢ Uoith rnetam valor: float fun ( void ) {.. elayn 2456; 4 Float % = fan( ) Libyawy:- To ence our C applicationg Pre cle fined progiome sec! Heacley fie ts a function of Col lection of ‘predefined functions: i Cc Ubray is a Collec fioh of healer Files. TDE t Tintegrated — le velopment enviowrnts Cy C++ ——> windows Mac Li Nox Blue acreen( IDE | Con sole ( Black} “ Blue ( Editon] ao soe oy Fh 1 AlE +FES compik — Alt +Fq Run — cob + F9Bako ect Syntax : ata type inlentifiers €xy Ink a3 Repyesen tation of data fs Krewh ag Data type g Classi fication \ “use rcte fined primtive / Devived int Ayay +> 8 buchoy chan pointe» t—+ Union Floak t Noid pe det > enum Signed —r +ve | -ve unsigned — +Vve Shot; 2 bytes. * ink <= wnE 2, 4 bykes on - long U bytes Chain’ 7, Signed SS 4 yy Byte: On signedCy bytes} Floak Fisk <— double (a bytes] long clouble { to bytes) l Byte = Bbits Unsigned ShorE — 9 bytes al€ =" 65536 = 6 to 65535 Signed Short } —> 9 byte — 65836 z —390768 to 30763 ~ 52768 Signed declanactior) Pe Shork a 5° . & ShovE ink az 7. d format ow Specifiesis Signed ShovE ink a: Unsigned declaration 7 unsigned Short ay oy’ an Lu Ongigned Short int a 5 = ) +4 ‘ fA¥ include
include < Conior h> main( ) £ Short A = (0; ely sey C)5 PrINER (CS dO") as 3 Signed Short — 39768 to 397467 ENE ve # include < stdioh > yttinclude < conio: h> c- main C ) fo ; Xu ‘ "Shore X= 2 096q [-39%63] clyseyve) 3 PrirEE CA dX)Uncigqned! clicle ‘ © lo (ve Ob signed sthowlov Vy . Chien jy pyink (OM uy yy | 656 2 ~y Uyjle © 98-956 a Sign wel P1998 “lo Loy chan l= ™ ~ Ob signed ly Ibyte 2. 95¢ > O-lo O55 Stonecl Yange +. y« - / o Je tH WOB lo 1a T] tiby how! Uerit He presenslertion in ‘nleges 3) Hous cary we &lore a Symbol into ( Pyle ‘of racnory 9 63) what ig chanacles Systean HW Whak We |, ASCH,character system Using choractea System We Can Hepirs,,, an endive language. Ex! English: Asc) Chanacten system + Americans Standard Code fo2 inforrnarticn, techhobg y \- -A- 65 a- 44 o- 48 B- 66 b— 98 14 | : ' | A \ ( 1-9 Js 3-199 4-64 35 pee ano!) 1 + include stdiosh> maine) if | Chan ch ="! PYiINEF (Ye "S ch’)j ou; A prinEf (Cs wd % ch): ouks es 1= tp inclade
main( ) chaach = ee SZ printfCs fd" ch) ae PrinEE ("AC ",ch)5 t 4 Un Khoush chanactes Printesr b Waite al iC Program _to _cisplig ASC. valae of chan 9 Hhinclude z stdior h> matin > Chan chy | : PrinEf (* entra one character ;*): Seanf (“fc ,%ch)5 ¢ rai memory location to ch) PYINEFC’ “Asctl value is ted “ych) iyShing h Stdiowh conioh Stiles yy Pyinkf(); clrscv)s Styraeve )} qetch( yy Jraphics ch get dater 5, | gee irnel 5 | + Colourtd; ) Sizeof( ) ie v Predefined function Pare | TE metuins “the ste of rekirn thing. | oye, DO Navia ble: . . 2) Bata+bype 3) CLpression 7 eesr | | 2) Lirwibs of ei Wy Vimitssh . Ly 1- predefined Variable.trlobal Vaviables | &e Cay @CCCAS i Copp yor Constants ( vor Can't | mneclity | aHtinclade < stdiosly > main ( ) » chav ie pt Shot s 5 4 i print¢ C Sizeof chan! +/. d state) ' oO) nr PrinkEc™ Size of chan y+, ef bylegs) \y", Sizeo€ ( cys “PYINEE(™ Sire of chant fd stxe(s)); Prinke (« Sire of floak ; tod", sire of a (flat) )3 : ere dyes Aor 44Hinclude< stdioh> x include < conio h> 4k include < limits +h > main C) 3 5 limits +h: Global variable, = —\y le Shot + headevfile inks _ § SHRTL MIN ~~ *) INT — MIN” SHRT_ Max Int = MAY | Lnsis- on OSHRT_ Maye VINT_ MAX Prine ("signed Short min Value corktanlks tong Lone — 1419) LoNG — May ULONG — my i hd \h, SARTRMp, Prink E(* Signed shoat mar abe hed Ly shen y prints wnsigned shomt max valueis/dln, USHRT~M Ax);Modify operato>s s Uniary Operators, Modif * : é & Nn opraaton Can Revfomn operate on Vv Singh speranel: Trerement elecrern’nt (IN¢) C vec) JN LN eine b- Predacre Post Pre— increment Pos! =menk decrement ‘increment [++ No aiakte} (van +4] [- -van} { Vay --} SS ink L =t0} Bee tH [t+ nord ae Seer (x=x+1] x=4 (rs-1] Pre - Increment Bre- decrement Post i Gemmen post decrementPre - INcremen L | posk- incvemenk > Main () ink xX Elo ry 5 Ye 44X35 . VINER CY dd" yx y Prin EF ( pH) 3 a eu [zt ink Xs 10) y5 Ys W4ts print (nda ved 5 vi s 6 WN t0 main C ) t inE X =t0 , Y= 90,35 ° Ss t+ eK Hy 5? PIMEFC dy Ved) “id's Gy,3) Selution:- he y = (4 —> pne- clectement 9', 10 * 19 +, subs ttation.2s Bld 2 Evaluation : YW 3 = l40 5 Assigning vqlues. Se Kat sD Past inclement Xs Yo3 dod 4d ul 14 (90 main() { ink Xe ee cs te htt +495 “PYIOEE(S hd", 4) , . v 3 13 Ir 44H = Go +7 preinciernent a x26 ~ Substitution. BR 6 46 =» fvaluation qs lp a Assigning §' B — — Posk incrementConditional statements a if Q: TL- else 3. Nested i€ - else ye else-if ladden. Dre- cise: Syn tox “TE Ceondition ) few 4 else t. chur Statements : Fat foow msg 3 2provicling optional inforenation to cndusey i condition fails cS la it) write a Program to check “the given Numben is even @xy odd number #Hinclucle < stdioh> im H inclucle < conio:h> ink maint ink a; clysevey PrinE C™ enter a nam ben j or Scanf(“ Q is sp d 52D) iP (avo ==0) d PrinkC* the given number is even"): 2else § printf ("The given mumben to oclel MUVOby y g “Note: rn the deFinitfon oF i€ = b lock | if we donk Specify ‘using block {4 , only Livek “chatemenk considered ras | | if - block | skatemen Es es Nectede the blocks) 5! iqpt PhD f iO 3" y “pre else 2 else 5 ' #O4[Bike] | [Stare RickerLoops t Loops ant used 10 repeatedly execute & block of Cocle as. long a6 Specified Condi-+ton is tree 1s For loop ( mo OF ievations known) i itera tions Unkrs a: while loop Cno Pe ta Hong heen 3. Bo- while loop ( executes atleast st ", Us Break and Continue Skatements For loopy lmben 0" therein: jenoush For > Keg board: i _ Sites © a ®. fov ( tnifialtgotS5 pond Mion von b-Oe Statements ; J As long as Condition is true the _ iterations sepeated »Initial zation for (fst jy t< s105 itt) PrinEEC’ jf i ttadin'y ri ve wiles Hee 4(Sum of Fivsk » mgm bea Values: includkg stdioth > main ( ) : t inE jt y Sum =03 f pryinEE(® enter valu); sean (S wm ts yd Kn)L for (fat j hcn 3 f4+) Sure = Sum +1 3 | 5 | prvinkEC® the Sum of Fire ‘hd sambens is thd", 1, sun 4 perfect number: Sum of factors of given mnumbey CLtpe TEself is equal to Same num ben:en fe 1 2 3 4 5S 6 x *¥ main () inE wy ty sum=o3 printf (“ent b values"); Scamf (S hd ";ken); for CT=13 fen;ityy tL i€ Gmbh = x0) 2 Sum = Sum +i; y y _. EC nst=sum) t Prine F (" Perfeck number"); 5 else 2 print (* Not benfect nambe a"); 5Nested while lating wWhill th side anothey while loop Syntax uhile ( outen — Con) t => ottencohile Starfemen ty + while ( tanner con) . =~ in wo} whik Statement ; J > outeawhilt statements ; i kL) While loop i- uohile ( condition ’}) } ue ae +o he executed! y ink t= Oy ' while Cizs) { . printf (9 wdinty i); “Atty 409 - while do { [| code +0 be executed Y wahile (condition ) 5 Prion gears a2) ye §e3 ye \<5 j=) ane ny x x ico ¥ YY XY x x te3 XY XY yY ¥ Tey x Y xy“ ¥ fies X ¥F 4 Kx for ( Pot; tees 5 T4++) 2 for (Jet Je =ssstt) t print € (“x "); prinE(’ \h"); $x x tL NG Kx x x xX x | x OY xX x % for Cf =15 fess +t) for (j =tj3 Jeet 5 J+) i prinEE(* ke ")y prinEFC “\n") 5: %,(oy Mok oO L, Number having & factors. a YS GF, count = 9 prime numbes Progyarn in Ce main( ) { inE Woh, Counk=03 PrinE EC enter Valives 5 Scant (* ted Tk ns for (T=15 igen; ttt) if (my ts =0) t it count ap 3 5 1 TP Ccount==t) f PrinE ("prime number"); 4 else f, : prinE(C: NOE q. prime’); ElsPrinting Shong numbexs in the given Yang r H indudeg stdioh> main¢) { ink limits r : Nead limik; : H for (wel; (< =Uimit | N44) | Sum =0; while (n yo) t ne ” 1 on ‘fact ai; for Cis nj dpe i3i--) t, foc = fack & ij 5 Sum- =) Sum+ fack; my Nee H/o: if (n= = sam’) no PHIAEBS (NY sting (nin),@SEong Numben:- Ne (U5 / factovials of individual digit in number is dum is cqual--> same numbea. main ( df * inE y y temp, 1, Fack » 4uUm =O Yead 3 temp = v3 tahile (m>0) A= WhO; fact =; ; foy (t= myi r=1;t--) t fact = fackat ; Sum =. sum tfack; a : Ws vet L105.‘ © ' ! 2 Ba Ga Fibonacci gevtecy an Ab inclad:< gbdiowh> ink main’) { ink my aro, bel,C} prinkf ("end lin ide") Scant ON th di" wn ys for (f= 13 Tam; ian) : { relat palindro ree onan bes program i A Aura kes” ic katd +o palindrome ‘numben | ie hie mevensal of given ‘Number t4 equal -b Same number:Hincluds< stdionh> ink main() { ink myn, 4um
0) 5 ‘ = W'h10; Sum = Sunn *16+n5 = /Ilo3 » N= temp; “ie (== sum) J PrinEE(® PalindYomé numba); y : ; else i “ry : Prin EF (4 Nok.a pa lin drome; 5 3Armsatyeng numben program 4 The Sum of individual digits (calei equals -f0 Same pi muniben # 1.53 m= 134.534 33 = T+ 195 +oF yn = [83 Hinclade< Stdionh > ink main () 4: inE M,C, SUM =O ,TeMmp 5 printE(4 enter hh valoes "Ds seanf (2d 8 emi ctu EC 1 : While ( n ~o) te a= NM) lo5 C= n¥N*N gum = sern+e 5 nn = [los y ~ = teenp ' 2if (» == sum) prinLEC* Avmshong")! else Prink £(" Nok Armatichg’) ; t Revensal numben of given num ben ; N= 153 L, = 35) #Fincluck
o) t N= wy. 10; & = SUM *K lo; Um 1) ie colton 5 aFacto nial of a given naam bear - 51 = 5 XGXS KOKI sthinclucle z ¢tdliorh > inE maint) {1 in—E n , fack =I printf (“ender 1 valor “Dy SeanF Cad “wen )5 for ( TEU 3 tz hy 5 BD) fack = feck 7 “print nas fact); 5 Printing Pacers 2 Jeo S50 Tea Tes Tq. foo Yoy yoy y Fer yy yoy fer yy y i=2 yx otfor.( f= oO; TK = 5} i) t ee for ($515) <= 83 j44) t prinef CMR) 5 PYinEFC"\H'); (ov for Cis y siz so ;i-~) for J = i; joo »a--) t printe( UES) f 2 yes PrnEEE “AnD; 4Printing Pattern . ie ev jet ica ° oa a _’y is] — aia ¥-¥. te2 ee i —Yy vyy aa Yo oYyy ¥ : : ‘outer bop =. PUrmts for isos THY ZI) OMe for (s= 5 fee 4s iH) {print Ce 8); . ; 3 : ~ for (Ke f j Kési 3k), prinkeé Cee } PrinEE(" VB"); 3printing patterhs + S
You might also like
Introduction To Programming For Engineers Using Python
PDF
No ratings yet
Introduction To Programming For Engineers Using Python
358 pages
CSC209
PDF
No ratings yet
CSC209
72 pages
C Programming Language
PDF
No ratings yet
C Programming Language
55 pages
Byts Week - 4
PDF
No ratings yet
Byts Week - 4
18 pages
New C BALU
PDF
No ratings yet
New C BALU
214 pages
SL Imp
PDF
No ratings yet
SL Imp
17 pages
New ?
PDF
No ratings yet
New ?
25 pages
Photo_compressed
PDF
No ratings yet
Photo_compressed
64 pages
UNIT-1_PSTC
PDF
No ratings yet
UNIT-1_PSTC
25 pages
Programming Keys
PDF
No ratings yet
Programming Keys
20 pages
c programming
PDF
No ratings yet
c programming
26 pages
C Language Notes-1
PDF
No ratings yet
C Language Notes-1
41 pages
C Program Notes
PDF
No ratings yet
C Program Notes
137 pages
C Programming Notes Part 1
PDF
No ratings yet
C Programming Notes Part 1
24 pages
C Language Notes-2
PDF
No ratings yet
C Language Notes-2
40 pages
Luciano M Barone, Enzo Marinari, Giovanni Organtini, Federico Ricci Tersenghi-Scientific Programming - C-Language, Algorithms and Models in Science-World Scientific Publishing Company (2013)
PDF
No ratings yet
Luciano M Barone, Enzo Marinari, Giovanni Organtini, Federico Ricci Tersenghi-Scientific Programming - C-Language, Algorithms and Models in Science-World Scientific Publishing Company (2013)
718 pages
C&Matlab Primer
PDF
No ratings yet
C&Matlab Primer
412 pages
C Language 1
PDF
No ratings yet
C Language 1
15 pages
C Language {Unit 2(Part 1)}[1]
PDF
No ratings yet
C Language {Unit 2(Part 1)}[1]
20 pages
Loop Questions
PDF
No ratings yet
Loop Questions
18 pages
C Programming and Data Structures Notes Sample Compressed
PDF
No ratings yet
C Programming and Data Structures Notes Sample Compressed
8 pages
Assignment
PDF
No ratings yet
Assignment
33 pages
C Language Notes
PDF
No ratings yet
C Language Notes
97 pages
Bhavya 28th January 2023 Notes
PDF
No ratings yet
Bhavya 28th January 2023 Notes
13 pages
C Programming Written Notes 1 Pages 1
PDF
No ratings yet
C Programming Written Notes 1 Pages 1
100 pages
CPS125 - Course Guide
PDF
No ratings yet
CPS125 - Course Guide
60 pages
Bceq I I PDF
PDF
No ratings yet
Bceq I I PDF
171 pages
Engineering Questions
PDF
No ratings yet
Engineering Questions
162 pages
Introduction To Computers and Programming
PDF
No ratings yet
Introduction To Computers and Programming
441 pages
Book
PDF
No ratings yet
Book
443 pages
Bielajew, A. F. - Introduction To Computers and Programming Using C++ and MATLAB - 2002
PDF
No ratings yet
Bielajew, A. F. - Introduction To Computers and Programming Using C++ and MATLAB - 2002
440 pages
Programming Matlab and C++
PDF
No ratings yet
Programming Matlab and C++
440 pages
C Language PDF
PDF
No ratings yet
C Language PDF
115 pages
Computer Programming C++ (UTHM)
PDF
No ratings yet
Computer Programming C++ (UTHM)
75 pages
CEA62 Assignment 1
PDF
No ratings yet
CEA62 Assignment 1
7 pages
C-Programming ShortNotes
PDF
No ratings yet
C-Programming ShortNotes
7 pages
Algorithm SC 2006
PDF
No ratings yet
Algorithm SC 2006
138 pages
CP by Triz
PDF
No ratings yet
CP by Triz
68 pages
Oodp Unit 1
PDF
No ratings yet
Oodp Unit 1
38 pages
C Language Assignment
PDF
No ratings yet
C Language Assignment
16 pages
2Nd Chapt Fybcs - 10 - 07 - 2022 New Doc 10-07-2022 14.06
PDF
No ratings yet
2Nd Chapt Fybcs - 10 - 07 - 2022 New Doc 10-07-2022 14.06
11 pages
C Programming and Data Structures Notes Sample Compressed
PDF
No ratings yet
C Programming and Data Structures Notes Sample Compressed
8 pages
2019july
PDF
No ratings yet
2019july
4 pages
C Programming Notes Part 3
PDF
No ratings yet
C Programming Notes Part 3
24 pages
Programming Fundamentals
PDF
No ratings yet
Programming Fundamentals
169 pages
ch1 10th Computer Urdu
PDF
No ratings yet
ch1 10th Computer Urdu
27 pages
DCP Unit-2
PDF
No ratings yet
DCP Unit-2
22 pages
Introduction to Programming for Engineers Using Python(1)
PDF
No ratings yet
Introduction to Programming for Engineers Using Python(1)
358 pages
1
PDF
No ratings yet
1
19 pages
PPSC Unit 1&2 Lesson Notes
PDF
No ratings yet
PPSC Unit 1&2 Lesson Notes
94 pages
PPS Unit 3
PDF
No ratings yet
PPS Unit 3
27 pages
C For Engineers Handout
PDF
No ratings yet
C For Engineers Handout
44 pages
Document
PDF
No ratings yet
Document
44 pages