[go: up one dir, main page]

0% found this document useful (0 votes)
13 views37 pages

C File

The document contains various programming examples and exercises in C, including basic operations like printing 'Hello World', swapping numbers, calculating simple interest, and determining ASCII values. It outlines the steps for writing and compiling C programs, as well as the expected outputs for different scenarios. Additionally, it includes algorithms for mathematical operations and conditional statements, demonstrating fundamental programming concepts.

Uploaded by

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

C File

The document contains various programming examples and exercises in C, including basic operations like printing 'Hello World', swapping numbers, calculating simple interest, and determining ASCII values. It outlines the steps for writing and compiling C programs, as well as the expected outputs for different scenarios. Additionally, it includes algorithms for mathematical operations and conditional statements, demonstrating fundamental programming concepts.

Uploaded by

ridhi47953
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 37
P cud:- Ps 7 Qin: Te point " Ydlowerld " Sefhoore Reguived ~fedtia Lonuse 3) Viren 4 are Oa noon clad. the Code Thay = cit wide ‘gobi , pod ‘the mensagi- saison O40 budjook ducers Foca a eee “etast Got ' Cal fomctin to prod vudbacrld” Stet all “ 1» [ Diplo pst ~ Diuplog "Hello wold ‘Sept’ - Ed at ncludy FY idemoin of 7 porap ("Hale wold”) 5 | won or Vt PS E:\PROGRAMHING> gcc HELLO_WORLD.c PS E:\PROGRAPHING .\a Hello world Alam - 7 protat sum % tao’ rusmbors Sofa Ronuirad 3 = us Code ot fedora. Girne. Ima: 715 pad -hor munch fa, cade fi Ergin On, poo LBagek eb Seem ] [Size] eae vos aad ‘pal , 0 et ed eheno safe 7 [pipley Sem / Paeitm 3 furen Ofer Auccens enccoution Gnd) Step ~ Storf ~ Dkep 2 - Deelads ay bie oa hcg oye Step 2 ~ Read the Vola of O onl \procRAPHING? gcc addi J spt C= orb ps e: > gee adding-c a BS E:\PROGRARMIING? G 2 Steps ~ prod C value value of a = 18 and b™ 28 Stet ~ Sh sum of a and b = 30 oF ps E:\pRocRAHIING? () Codes - ae lypclude, ack soon ©) Pap (°Exbt mumbits 40 be added '); Stang ("fd fd "ko, &B ’ Proialf C*Volaeof a= td ond b= fd") a,b); C= arb; pri ("Sof a, onol & 3 fd We") oN. | / ya} 0 estice 3 Shy Plien 2— Watt. a. ptogrronme 4oAwap hae mumbov without why hind Vonoble « nodee igh) /Derbone~ arbul amd Reads.” lun ofy O.ovdl b =/ Soffusoke Regus! — fedora. limure. “T foe inde >— He a baat Sang s— Defi nt meta), nad, deo 400 variable cond! ae “as ae odin, optabins to opal the Sonpped vale Rath 0. ond b thon = Gn eS f J ota. - Deolese-vosteble a ond 6 oxi Step ~ Ged the Value of 0. and 6 ° skp 4 y= Posinft Lob fs ond & befor awoppre Sips it~ a= arb Skpbi- b= 0-6 Sept - a=a-b , Stpei- Print Value of o ond & ofr pourpey eer Vix Cad PS E:\PROGRAMMING> gcc number_swapping.c PS E:\PROGRAHING? .\a | ‘SWAPPING OF TWO NUMBERS WITHOUT THIRD VARIABLE Enter value of a = 100 Enter value of b = 200 Before swapping value of a = 100 and b = 200 After swapping value of a = 200 and b = 100 @ ee le |. tat amain (9 4 ; \o\> Pree tayo no. a ond 6 \1"); “ve \ Seong" spd") ko) @b) 5 | Paid ("fo cumppig ovolucaf obfd ond bie file", 0,6); O=atb 3/9/2y Feacticof-¥ aan Ains To Swap fuer mumbo using 0 Hef Voreabl SeHowe Ro utuf s— US Code of Minue fe pa en fy, hueds 3— To Sivop “a0” mumbas sts ied fie mbes vorie toe ff [Deelore a7b,c Omal Suad a ond ‘Ss Cc oO b =a fen Eaft tmeitn( 1, eleclase Br (oe ge! of mph. Storoge atti the fal umber tothe loze| “tponate u wt [Revit 0 ond 6 of Seep / Algphthom'- Shp Stok Shp 9 Declare vedcobh a, bemd ¢ 04 infeger Grol) Sep 3- Rod the volar ef & ond b Stpyi= C20 StepSi- 0=6 5 Ex\PROGRWHING? gcc nunber_swapping with third vartable.c | cup 6i- 6 Fe PS E:\PROGRANHING> .\a Sipps Ponta voles fe ond SWAPPING OF TWO NUMBERS WITH THIRD VARIABLE } . Enter value of a = 10 Sp Vi- End Enter value of b = 20 Cody ~ Before swapping Value of a = 1@ and b = 28 Feld ' _ After swapping value of a= 20 and b = 10 wee te he PrfC unpey of 400 membas with thisd variable pr"); ae edt ("Ent ola of ond b ”)s cet ayd dale), ) Prlf. (" Bef So io of aatd omol 8 fal ln", 0rb)5 ) C=a; we on Painlf ("After Swopping val aw fd ond bis Yd", o/b). Belurm OF Seaton Aim? — To Caledals Simple Sntraf ri code tatpal Siffre Rained 2— idea, line 8 US Cs cle the prnspyy Inert: Sockde bef im ©. aFpreth iwliuat > \ ="); prids (ert rp ae tof 8s, PY respec wl ve =“); tow chat §— Ciewlt / Deolote, Boob iatooat | edo = (Pet) /oo J Patat inbovat Emel) PS E:\PROGRAMHING> gcc si PS E:\PROGRAMMING> s\a Enter Principle value = 19009 | Enter Rate of interest = 7 | Enter Time to pay loan = 2 Sinple interest = 1409 Total amount = 11400 ‘inple_interest_calculator..c inal = Stel -< of Prd ("inple ual f efi 0.5 d\n" ict) 5 f Pad agcit Valu God) PS E:\PROGRAMMING> gcc asciivalue.c Enter any character a ASCII of a is 97 PS E:\PROGRAMHING> .\a Enter any character a ASCII of A is 65 PS E:\PROGRARING> ff Rockin! ¢ 2 Aur ‘To prot Agere Vebuss Crate chesochi Seffroon, Sepubef -— fidoro. Lise vs cody can amorp 2 Brel ceeake tab maim 0) ead Fhe COO With Samfr> ond uses povit ( wf) detec bie shows the nsoetins Aactt volun af C1 powk tv Plocsithem s— ti- d Brae ae yeti cee cat. skp 33 —Rad'the cheraclin of ch ary skp 43 — Display the ASC Value shps 3 ~ Ey Cody? at bnclady. ict macn 034 Char ch } pred "Err ony. cflrcatn (n”); as 3 Seonp Oe." Reh) 5 Prost ("Ascer ef eis fd tn", chech)s } veto a Va wl [ 9 fet gcd) adutiroe ond "A Jo buon Dvaprgo ions a ereele AMgviillom ®— cup 4: Bont 39 Sh a ~ Difoee operas Coleone Hl ‘ oporofa kp 3 Pavel ouitbuee 1 — Poiof lontenf opurafn fick calabione poate + = fotenal ouput pp i ~ Gaol 7 /Diigag 0- pan 8) } Prrindf (" Grcakor thew. equal-to “fal >= fd n'a 6); peep Not Couol to 3 yd | = "Ad \n"s 0,6); posdf ("less thom equal to spd < = fd tm") 6/4); Jreloclf (b> 0){ » . eet "Goealt thou id > lm": bo) Beir Prd eats Ha ual he > ="Ad ; pret {rlok oval fot Ad | = "hd 6,4); proaty 1 Hon equal to fd <= "FAY", 0,6); (ax~6)4 a,b)} Mtg ced = "hd Tock Chiegioof odowel, * veal oy ike low iotaes C Slot _S Read o- uw folse Of. Q==0 Tet Lip odd’ FBiopleg Eom / top) top. ep ey toyr by $——To fig whan, Hae member ood 220" uashag Condition pat, ented % Usd Soffoomw Regudraf *- ferltor Laure oF US Codke- umber, uae the modal opiate J ty, 2: 5p He Sluayp = Para toe war et. ocho te cermatndie when divide ¥y Bomoimdn i ow THs every cthawotee a dd Algcsithom 5 — ir Stof 44 ae Sepak omer Shp 3e- Com pus Romotdt Step Conditional cbreck, Pat odd Joven steps Shep 6 nd Coole Wher i Ae bnclude eT Ute aint) { fh as "yj Dy reasebg Ups Ben m0" 6) 3 (ith (pals ool t ke —ESES————_ Protea) 10 Jofafee ms Te fied loge of hoo memo vag enitiud’ BA uses Seffeeche 3 fidera Lin " yy — Prompt th tae dott tor oboe 2 conotonsf Hremmatsg) porter $0 Comp w cperakit evoluattt whieh numb & larg Condlitione! opsots aoe Ot US code’ ore the Geo _ natin Alggstthon § — Stop i — S 3 d sup gs pet foo mien bd weg K 3 — chuck the eel Condition sipys — Defrorime Hw lesger member stpe tm dap ley edps Sipe i nd Code? - ag ha ree ead ab include en? veld main ot fut 0/6} Priel, Exton to umbers Me djd™, Bord5); ts lege thon “Ad", arb) > da leg ton id 1 br O))5 So i S 46 flow ( Stosf > [Bec loser Sie C1 lrby BPE] Read (,Uibi* / jo= sid *oul. | c=ltb | / Pot oe syuohe / chu} I fobueo. “peje csp) 2 f 17/9 fry fi Phim — ua © pregrom to find ei. of recfongle Spratt On2 Osiele vabec Cntiud y va Sopfoohe requihul F— US cords OF fidera limune Thussy $ — the proghom oictnudd all epenaitirs otra, Unoludlin Or Ra mb) Sys) ond koh. (xteo) by Usizg’Qoitch Case and potnt-th ohiod Bnd egplicetsin vu emtoud by vse Algcaithem 3 — Step 13 - Sart ale = choterti awe to jot Step 32- Aassratie Vola step t — Roiwt Hu obuon Shs $ ea ae ve L ae Petes ee ee er ee cre eames En coe] eer i ee aft Proakivel= (3 oa Arm — TO ad lexyqoat of tHinee ambos uatng ee Le f ee, oye } ju wales 'f Safposhe Rudd? — v8 co & fib in 9 f ut vs on fi i ae past ¢ beh the beans Agcrmpt He. wae to vip cle Statament +o Compa theta mer" i oped evabust “onal, vo. & (ong ound exebatio. lye cae ae — Stab Sf a Sopa thee, pur bo orp - chuck the Comdlifien okpy - etnias the [ong numb says — Diaploy, exdpat Steph — Orel Cadden 8 7e Pnoluole SStdio-h> inch emo) a inc , Pe | dati treecmumbenlr" Srbepe seonh (Yd Jd f8" kor Kr KD; tf fade && a>c)¢ pais Bigat memo 8 4d", a5 jee 'b (b>a a boe){ pout (* Beet mam ate "))) eed : (rain oxd", 0), ay o\ oN Beoalion|-!Y Baldo Aion TO fpid th, foto) of jive mira Sofficta Rayuied = us tode-op feta, lin Shuoys. $ — Ths product of all Jto a produc! ed Mt positive ‘wbgerd " ‘thonagee iene positive Putian ® cr J fim pos ei and dad ty et Ee ee Algesdthan — on ak th usd to ent on ie fied fectoof 3. Reowl the “vtig cin ox vebuob le re 4s pao” the Vt als fo 4, multiply each dae Opa al adept to aml 0" x a ete ae vale, ee enol of elt mili tl ‘ focks : ney , Tagan! att CF sa a ¥ ‘Vv pe Ww flow chon pla fe qua Shy? tm ec} Penal Practioal _'6 21/9fo— per trae Aims —To find fibroceé its Soff Raguishel t — US cooley fidora, Lémune Fhuary s — wer fine & cretunnive fnction momatd fbmacel©) F° aman) frsction we? t onnate Pbomocct number tithe Prompt the wade 40 atin the number %f tom * fort ode Stotimocl fibmoccs Gente slog pw Algeidhm’ = — 1 Declova*hree portable om, oF Hf od Sg. Sef initial volu of 71 =? omd 2=4 Be Diaplog te valued f 1 Ye oct ME = mM END ond m2, cud 12, adh ng fo the preset S. Display Ge sea equal to be 2 valu of 73 + Te Re cS 7 of on Blom a peat oer 2 th pr ani ‘* wach Cody — af Uagludy estdlioh> Gt main tt mi =or “hd 19); sie +t g— To paint wevdae of amu be offioanw srequibdt — V8 code 6% fedora. Uinune huey Sut prepa toe One Usimny arcu, ramon vote — fulton fo veveise Fann entouref ay bin the mq Co Oxplametin 4 the paegiom #2 ond % f 2] yum bot porte user Lyn everse,, =O, 200 a 4 thy boput murmbdt vate the emnodullas epoca, 2 ultcple He wequene mumbo" lo « Add the lost cau 7. Dede He mumbo fy fo move lost digit @. Embn loop 9g. fri geuae ruanbor 0. md Woe" Coy, vowd ond corionly a Coxe ts vowel b Comononct thon § — So cused ppt che = Read ch pore Uabe Trath ten come & 2p cane voworld shabel § ote eo" sy ehye Switch (ch) Test Ps boreal Cose'ehs a ger Cose'o! po vowel”); boeok} Cot ayy oy; baraks ) ") Be ee ee teary Lean en pee 5 enieereer : oe Pee eee i ae eae i. au [ofes 5 . be bet Diy s— Tofind diiatotqon fostere h ogee nen Seffiodie Read t- US Code Ihevry $ dhe program fied divints ba ¢ 3 and ibid foctvil by oma Mumbo Algontthrm - f Dstt A Depa te ty vel prast mumfi==9 3) “fi Sloe: loop frm 4 tomar ae Mumbo pen doom s) Guctpick okebracr ond foctaol Codes - since, Befomomt) 4 . Saab mum ply fod proiy ("Ekin amumbe + | rai FAQ GC ° y 4 (ako (31083, E3931) { frrgeaigey nfl =e CiIEj] + CIE; af, ofa); Pritt ("mn"), eee ee) Sette Ley base Recte ee ery lion Tet are en v eo eee 3G) zopid 77-bL1G] 18" pent CILGD; ‘ Poin; } } void mata arg 9), #5 EA} E37 { Pape es abtract rate 1 nd Mat er Petar Goiciniane 9, eer reac bernard ' Sabtrock rotelx 2 and rutrix 2 Vor fey ee worero Peep ee eae doce ley (ie ae a pst eres t){ bitte nd fon mobic \n") flint poop fda e fs igi i r ele ee eareereeee ete La bat " mobice 11 G); _ 4 bate oun 4 = reagent; Crster, eleomenfe a fist amotoicu\n”)s <3; 447) «atid tj 1); s +t te. an eporation ” add on 2 Sebanebin\n 3, Predict iW 4. Taondpents Supper Foitmpulay fn 6 lowes feo lan Dy Seon MLA deeboroe) | Switch (ehoror Cored’ add aqatsiees (414) 5 borak’ Case D: Sub octmafeict (0/6) 5 hecak | Care 3 aap medics (016); baeok” Cons, iypssbinngl @; botak- Cox 65 late Hienerla fo) default 2 oe Paved" Sovelid chacee| } Sehuhe 0° a) ‘ond Ja Conmmencr ait (031;" ne Sa rrr a reer see Airs (Pann ns guondeie ey 261) actin ans Pereaeel 22 ON [afer Aan: wit 0 Becursive pom for Hoon of Honot Rroblom Sofoare, Regu 3 US cad : thoy s dhe tod of Homoe pvelud rose ols omothir using recunsion folloueg Specific dolues ruled» | Aaasttns ) Defa bowe Cit Jf one dik move fron Souter fo 2) Recursive Gast * a) anove (rei) obask fs 3 aout thet, (yom onered to Souter to ousi lias fon Sever to dustimabion 1) Lik fpom bundy to dastination 2) Diplag cach, move Code wn 7 ; . “TL ances tot 1m, Choh Souter , chad, dustin often, chor ati 4 thine om 2 ’ poink ( anave- disk 4 fram eto fe\ [Sarid eh 5 ¥ aaapeel (rn, Seder wiley diltimation )j paint ("rout disk “Ld from cto to Fe n!Qowee, chatination); } footer ham Cyt y Quilty clutinion , Souter); a etn . : a4 FUR rumber of cba." ); She b Tse delve tou0e of homer in"); Fowreh howl (2m, '4'/ 181); svetum'0, ’ SSR ere Neal eect any arenes a haedanaigelar ds Last warts Ste) 23 “ish Aim’ Te Point the fist om fibonace: Soie offroad Regutied 2 Us Coole . : fad wecwasie jevctn crcmed| -fibenacet () to at, forse! snort the Ma wnction toe. prompt 0 ety the number ef term fe the fibenaeet 3 pete stabomunh Agosto 5) Deelose tote votvable m.m2. 3 a type bat 2) Set intial Value z. m0 ond m9-=1 q 2) Dipl value oh mi me Nab Gh= nem 3) Poy me 6) tow Sefthe value, spel te the Cutt 9 and motothe preset vol 3) Emel se fs Cocke: ~ 4 trolude Katdie b> Unb omeint luk m= 0) 92545 3) Lynumber; muses Of Elomah ) Bastia! 24 92 frofay ©) (lin? ~ Am onsen ot excel Conlins ffetmotion of mameges anal boot ous fe i ny. Pai ae def a “ake 82 ond wetken Ba Goole d ukiny in Sepa. las | Sefton Greats VS Cole Dey s UWoe Me fi fo white Spain dato of om obkon of Struct neg’ Ue fl Sq fie boad he a $ i Alga ) Define Stouts of employ coro = 2) Smpul: employ date. P)2 eptn fl fe ovocogss ord wera . ty while each, eorplaye bo He cppreprete 4) loop ther file S) Clayefilo oud Eipley Saerrs craton Coded — #Ctude Stotch Ginploytet wt tds 4 chor, owe 0] = hah ole C0) Ssers\pushkar Desktop\web development> gcc record.c | Hidbeplsaridlacserodcrce et Mos en Sears | : { Semaine Secu COL Sst rae Cola cumead | int mma 124 Caesar hkar\Desktop\web developments Stuck employer CI i 109) : (103) "cond" /oneat")' Clot; “Dave” wnker”) yy mt me¥j Free” ‘money pple = Fopen ("menagy tot FILE * tomka file = Fopon ( werko «te per (at as oj ixm pire) = if (tmp (empliyn C0) vale" Povey”) = . al (mos Dip pwame | FS [" cmp gee ‘OB sid emplages al snorm) , f ot (1 hatte EDS Fay Nome: ZS)", locfpridf (oa at tiesto emplewtes ci se feleae (monger file) | ys cane cematet t : archi} Gate keoce ees PxeNeeetr eae sen encrtd ees eo oe eos ig 3) iby i a) Cafes: Ah in eg . ony cork Cherosin tnt Code’ - ar 4 atdioh > void lant 1 See 074 lasth; =o: tohid (SF Clodhgy = =ho’) 4 Usgth +t; atength 3 2 dye" } Void Concafenol Cet bi 20, SDJ, clon ste20I) 1 ale irty I = her) Ha trs 4 : ee tet (i) = ‘\o'7 saya post toeatebl toby ¢ SYS) 7 I apocusasthy (chan, sts 07)4 tok lngth=07 \ whi (se Clath J! =") loath + fob (Gt (0; Pe lath [a +4); Che beep = sto[i] . Sto Li) = SteClyth 1) tol dingth 1) =thep | post rand S hy ystn"sk); Astinofiin itt; t dustivadn Ci) = “e'5 pst ("opi ohig = fein", datictin); fool Ug hh (stv); Concalunafi (sto 1,She2)> Devorsing (sta) ; Cop gots , FEW Seopied Be) j ac F \, A Eta la) Erion Peers e io PX ce ea aecta eg Ripe Renmin eas csok une rons Rete ss na me Cae Casey aafio fry fin To Cp Dm fle Foti ve Commend bie Prgumnoct Softanse wepuire) vs Coole ; heey Common Cn coyquments all Ob psig. fil mame deel Fs uming the program pile howling cpovelion low + Facey On fpule fociliols Conger wernt Aleetithon +») cluelethe Comeh numbed °F oh Pe 2eyen dee fie in eo eb oy Giosaation fil in ot med 2) Read ond we Clackoelins fom Amber for chstinctin until end ci file 4) clave bith fila ome paint Suen omeaseye elude. eb amos (dak ng» Cho’ * engel) 4 ip loge 129) Prt ( eget SSmecefil iin 68) FLE “ Souher = fepenlorgul), aye ECLE * dlatinafiin = Fepen(enguld, iF 1 (Source Rnie destination = = WvLL) { | pre BU Sosaepenig fern )i 0 Factelceures)) | = EOF: Fnutdch detnation)s 4 aa 7 PER AV le AK ot taN 4 ONY Basted 95 Qqfrofry Ain’ To store ecotds of a. Shudub vn studut fie the dito est be stond wai Briny file Read Ha, eeord Stored vm Beier) f bend ppl a stud file ——-Saffwore Ren uhed 2 Us Code. ; J She: - Bias fik-stnd cata vin binasy ppm, enoblin ost, : aeele, ‘omd effibiad dota “Stoo ‘9a Baclad reading writing appending and er Plgvetthon? —) Cust a Stouetion fot Sudmt otoble- 8) Adel omomu. options 9) Ue file ppmrati DDiapl enh omuasoge, Ih 2och action Coke? ~ inoluds, hates ‘Strvck ofuductsy it ids fa ane 51; pleat et 3; Void wri Rorrde>¢ FOE * ph 2 Sn 1 Meph)s Rie Fe g forne Studetstat "7 “op") > pov (" ftin TD, name, Goode "5 Tel. none /AS- grade ); Verdd reoel Reecrdats4 FrLE f= Fopen ("Shudick-bet “ab") Srouet Studacts | uy SS rere errr arery rs Wars oustiars Dosti och dovelormert> Feee* fi. Stouch She [avid 22 id) 4 prstfneo flowy Mode." )j StomP ISLE somone hs-gr08.)7 Seek = Cvk)), Posivd nt 1 wnteln 2. Read fm Guit on Y. ent \n Chedee Aches elaup Proree ==9) foeak: Na Renin LOUIE TE] ¢ 24) rvfoy fowdrcascy wppiiear® TO chovaxloy frome file chatort 1. ¢ allerd Vadis snip J can flf> Cot coch pe ‘slower, boupprn pelial fit wi ptod mode J 2) Grbeallge Coustidr ft 9) Read coh d vf ) ui the couyfs And Clave, Fi } tat lowsroan =0, 4 pesca 20, Munbds =O Spuecel Chok ch; 5 wltle.(ch= ge (Hie)! = 6B it (eolower (ch) ) towdichoaet ty cif. (upp hb) uuppacorert 7 cap cngl (cb) awebin ji } ela, Spec ety etn pi a at Priel (fousroare: LA lowecor); ries

You might also like