[go: up one dir, main page]

0% found this document useful (0 votes)
55 views106 pages

Pps Record

Uploaded by

Podili Dinesh
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)
55 views106 pages

Pps Record

Uploaded by

Podili Dinesh
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/ 106
| Pitre) Fee CCT ITT ETE EUTyY 9. |Poogram to fied gorealtest lof thnee ournbeas Progra to siead integer values rom keyboand. Program to aead fi UNIVERSITY COLL OF ENGINEERIN (KAKATIYA UNIVERSITY) INDEX PARTICULARS OF THE EXPERIMENTS PERFORMED f SINO, Name of the Experiment Page | Date of Submission | Remarks Be Theony 4-14 % 1A porogiam fon addition} 141 3. [program fox roultiplication 18 4. |progran foo division 19 5. [Reading data tnom key- boand using scant” 20 6. | Paogran demonstrating logical openatone ot 7 | Paogram demonstrating increment decnement | a2 8. | Program to find qneatesl| of fio numbess 93, a6 “UNIVERSITY COLLEGE OF ENGINEERING (KAKATIYA UNIVERSITY) INDEX 2 PARTICULARS OF THE EXPERIMENTS PERFORMED e ‘SIN. Name ofthe Experiment | Page | Date of Submission | Remarks: EE at. | Phograny to demonstrate r ‘switch’ statement aa B=) [osieam i findleum of "po natural no-9 ane 33. |nog. to evaluate the eqn Y= x eg (N70) a nalugal no-s using’do while] 48 25. |Paog to compute the sur of the digits of given no.| 44 : fol F 8 B84 |Pr0g to fod surn of 9’ FE > 5 86. [Po1aq to “reverse the digits lof a given no. AO &T- |Paog: to find the polindaom NO. USING ‘While? ma Frog to find Arnshong 00 Using while Prog: to fied whelby Paine ov not UNIVERSITY COLLEGE OF * ENGINEERING (KAKATIYA UNIVERSITY) INDEX PARTICULARS OF THE EXPERIMENTS PERFORMED Date of Submission | Remarks Severerey are Name of the Experiment Page Pog to find taagert of no. in| ary annay Parag to frnd sunn 4 average] 59 p1og for Fibonacci sevies | 64 Pov0g for 2-D antay 6a pag fow addition of mataiel 64 preg fox rnultiplicat? of matyice] 66 prog to ead seaies of names! 67 preg to ead aline of text pq fo staing handling fim) 13 16 51 Function with aag with vv func. with No aq no BY | TT Func wilh axq growv | 714 Prog to find factorial oo: using eccu®sion P10 fox stauctune Po10g fom nected stouctuye Peg fox UNION Porog demnonstvating gl | wetvives data ae and when vequived and divects output of the information. | Tr consists of following units: I | This is a unit itis yesponsible fox cavaying out [Arithmetic opesations lke additions , subtsacton ete and [logical operations like comparision opesations | Gent ot This unit co-ondinates and contsols the actuiies of al] units computes. It is apast of CPU. The main functions | peatormed by the contyol unit aze as follows = | + Tt can obtain the instsuctions stosed in The Memony | unit | Tt can undesstand the veceived inctructons. [+ Jt ensumes that data weaches the coxzect place at the | | contzol time- } |* It gets the next instsuctions aftes Poevious instsuction has been executed pee ah aa Memony is stovage of copmputes.. It can veceive , hold and deliver data as pex fostructons . There aye +00 types of ™memony . (a) Paimany and (b) Seconday se [ 2.D0S CONCEPTS :- | files z= Dos consider evesy seperate program aod | piece of data as individual files. Fach file has a name ced wilh the file on the dave. Names ave broken into | the file names and the extension. The file name can be no Jlonges than 8 chavactess. The catension will be operational lcan upto thyee chavactess fong the ealension defines the [functions of the file. DOS comes with a text editor called “EDIT. The common 105 file name extensions ave com,eze, | Bat, evs, TXT. DAT, CPI. | DRIVE AND DIRECTORIES + Each doives in Dos is assigned a doive letter. The fixst dave is called A> and nd as B: DOS cant suppoat floppy dives move than Tia - tuo haxd dives ctavt wilh letfes *c*; and can continue upto 2: CD-ROM doves usually gen the neat drive aftes the last dave. DOs uses a heivaxchical divectosy tree. To organise hoppies and hawd dives pos always allows ee) to sepavate files inlo related lists called divectowies. GStouctuse : 3 Main files :- The DOs opesaling system is a eae composed of 3 main files accompained by roughly so euppost files the 3 paimary files ave 10 Sys, Ms Dos .Sy6 SSCS LSSCLEGEECEUU CUCU TY BC oOPPTeS SSC CECE ERE ETUC TTT EVIE ci saat talking to the Bi0s and hasdwave. Ms-Dos s¥s isthe |psimasy Dos atten alled kesnal and command com: Poul inleaprets commands typed into the computes and |passes the information to Ms-Dos- S¥5 The cove past of | Pos composed of these thee files PC EENyallisce | The two hidden files ave Ms.Dos.4¥6 and 10-S¥6_ JTF these files ave not present on your boot disk the boot Dos hidden files ave used . this prevents them joil fail I for being deleted by 00s commands if you accidentally | delete, these files fiom your system disk The disk would | oot be bootable. since Hey ave hidden you may neveo jsee Ihets names on any dizectosy listi | BOOTING = Noe aan Booting 15 4 synonym wilh stacting a computer. I These ave two types of booting = a Cold booting Co) powes on self test owes awitch is used to boot the system. hlasm booting (ov) soft booting : The Ctalt Att +Del g fs used to reboot the system. Heze the Go key combination Inhenever you use yous PC you supply Devices =~ oan obtain vesult. The pieces of haod wave information and R [was \ ~ + Rekioing The problem : Tk involves aecognixing the ~ | Problens identifying exactly whal the problems 16 deteom: ~ Ming the available foput and output deciding whether the re | problen can be solved by using the computer. G 3 Designing the Algosithes + An algovithns is the finite set > of step-by-step inchructons to solve a problem ox prograrn| ~ alles defining the pacblens .algorithrn can be designed: me 3 Coding dhe Poogram : It involves actually writing the “> ishoucting in a pavticulay language that tells the computes | a) how to opevate | a) [4 Testing and Debugging the probleny = Mex coding the = i = = a 2 2 2 oe @ | | Program must be Ge tested to ensuve that it is comzect and) | ssemains (ox) contains 10 cxors. three types of e22025 or | bugs an be found which ave Syntax eveov + syntax is acet of rules by which @ programming language 1s qovesned. syntax errs occuss when the gules ave violeted while Coding a paogram. hogic exsos : Impvoper coding result in logic 820% can be executable but display wrong output. utew Program nbey of invalid WV. ALGORITHM ONO e ced The word Algouilhm comes from the Alkhowah pam, ithe avabian inventor and means awecipe melhod technique 08 psoceduve . An algovilhro is a step-by-step problem solving pooceduse thal can be carved oul by a computer The) essential pvopesties of an algorilbn ame : ¥ Tt should be simple + T should be clear with no ambiguity * 3 should lead to aunique solution of the problem. Tk chould involve a definite ournber of cteps to avmnve ata | solutions + Th should be capable to handle come unexpected studio which may arise duzing the solution of a pzoblem | Steps invelved in developing an Algovithnn : Cleaaly understand The problenn statement so that a i paper algosilhm can be evolved lo Study the output to be genevated_sothat Ihe input can | be specified | 3. Design the paocess which will produce the desired aug aftes taking the input. 4. Refine the process 5. Test the algowilhm by giving the test data and see desized output is genewated if not make Appropuate Jdvantages | * This step-by-step procedure: + Tt has gol a definite procedure * Tk is easy to develop fixst an algorithm: and conveat into] @ flow chast and then to compute program # Th is easy to debug as evesy step has got its own logical sequence: + Tt is independent of paogramming languages | At is the consuming and combezsion as an algovilbm is developed fivst which is converted into flow chart and ) then into a computer oe } See OCC CCCC CTU T ECT It vepresent connectors bets diff, 5 between dit? Stunnbo flow ct Yyratals of flow chast ee iE veprese, nt conan, ent box 4 O38, exent aoa af ao ff off PAIPP TERE EES -— eee . | JY. FLOW CHART i A flow chast is a diagvamalic sepsesentation 08 foictonal svepresentation of the algoailhn 0% of the plan of solution of a problem Flow charts ave vesy useful foo documenting a program) they axe constsucted by using geomelsical symbols. Each ! symbol zepresents an activity flow chasts ave vead from top to bottom unless a branch alless the nownal flow Beeeawedcs* A Clarity the program logic. 8. Helps programmes in determining the type of logic contd] to be used in a program & Serve as documentation, 4 The flow chast gives pictovial sepsesentation 5 - Sevves as guide for program coding. | Disadvantages : an i: biben flowchasts ave complex they quickly become complex and clumpsy and lacks the clavity of decision table. flow chazt should be redrawn. 3 Tt io some difficult fo understand logic depicted ina CCUCTITttTy | & Relalional : < (Jestban), >(qneates than), 4 = (lest than on equal to), >= (qneater than on equal to), = = (equal to) , |= (not equal to) 3. bogical : && (logical and), Il (logical om) and | | Clogical not) 4. Assignment openatan + = (assignment and opesaton) | 5. Tocnement and Decrement openatons : | ++ = incnement openaton | == = decnement openaton 6 Conditional Openatons » © 2,2” comes unden conditional openaton | Special openatons : one’s complement Bitwise and Bitwise OF Bitwise XOR Porogvam lemonstyating on incsement and decsemnent tinclude | Hinclude | void mainc) } | | int m=10, 1.43 | | clssco; | m++5 pantt C\n m=%d",m); Ua pant ("\n m=7d", m); ice) 5: pant? (ln a=%d ,m=%d",4,m); Y= M++; paint (“\n y= Zd,m-74",y.m); getchO; ae oe a= nm =12 K=13, m=138 Y= 13, no = 14 bs a pene 7 wead thee names: ae ee and | paint + / Windude | tinclude< conio.h> Void main() £ chat 94 [10], 92 [0] nafinl; clasco(); pantt ("\o Enter three names "Ds scant ("7s767%6" » &nd, &N2, BN); PHOH ("\n The names entered ave 1871675" getcho; | output :- a ,1,n2,3). ! Entea thyee names sahithi paya nishitha The names entesed are sabilty paya oishitha STRUCTURES - conttou i | Contvol stoucture in 'c? language alests sequential Reimers ec) ereees of ove progans | d ~ | “iF statement :- i | The “if” statement may be implemented in clffesent | - ee | , simple if > (ib) if else = Gib Nested if else FP - rm Fr rFP E 2 a rd 2 a @ e iy else if laddea G Simple if : The geneval foorn of sirmple if statement is | \ if Clest condition) 5 statement block ; statement x; ci iP else The ‘if else’ statement is extension of the ‘simple if} tement condition) atemnent block 4 ; fement block a; slalement x, 3 eee ne Te Ae ec le eae | 14 K progsam 40 find grade of student using ‘if else / | sHocludecstdio-hy | Hindude < conio-h> | void maint > int manks ; clescxQ); PaOtF("\o Enter masks of student "); seanf ("7%d", &magks); iF (mmazks > = 80) Print C\v Distinction"); else if (masks > = 60) PBOH (*\n Fivst Division); else if (masks> = 50) Paint ("\n Second Division"); eke if Cmavks > = 40) Poot? C"\5 Thizd Division"); ese printf ("\n Fail"), gqetchC »5 3 i. . output :- Entex mazks of student go Distinction an Progzarn to find the palindrome no. Using «while + / |tindude Pileude cconjashs | void maine) r (OF num=0, pk, E; chescoc); PEIEO Ny Eotew > value) Sank Cy d”, &o). t= 05 while (n>) a K =nZ10; Dum = oumrlork, | N=nd/hio; ! 3 if Ct==num) \ Pontt ("\> The given numbea is @ polindyome numbea"), > - £ else ; | E prott ("\n the given number is not a polindsome ‘)s \ getchO; 3 ee C | output :- E | —nter » value s Inn) ld s e 6 ® D y t The given number is a polindsome number TxA progiam to test whelber the ¢ OF ot +/ Hindude Hinclude< conio.t d mae output :~ Enter 4 number yen NuMbes (6 pume jven 90: is a prime numbex Ta ee program eee aay pant fisst ten fibonacci | (“Oumbess (123 6 8 13 21) UY indude |ANinclude | Yoid mainc) 14 1 fot Q,b,C,1,9; | clesex(), Pat ("\5 Entex 0 value"); | ee | Dey c i while Ci<=n) | $ a=b; | b=e, | c=atb; | | puott ("7 3d" c); es | iy getchO; Ey output :- Enter 9 value * # program fox addition of wo matuces */ | include [* lodude | Void mainc) Is | int afsifsj, brsits), clalta); 20); puott ("\n Entes 9 elements of fixet mater"); foo (i =03 135144) i foo Gj 5 je) scant ("7d", KaliIj])s g printf (“1p Entes J elements of second matyix*), fow(izo 5 1235144) ae i fox(j=0; j<3; j++) scant ("7.d", ebb 1G]; Ei fow(iz0; 123; i++) 5 fox (j=05 j<3;jt+) COI) = alia + 01g; LE ES ES a a a a a Tae a OT rw —_—_—_—[—————_ 1 | /+ Progvam to vead sevies of names and Htinclude Ain clude void maint) yi | chay name4 [16], name2 [20] , nameslinl s chas name4 [acl ; clasca);, printf ("\n Entes fous names "); scanf ("%s", named); scanf (" Ss", Name2); scaof ("75", name3); scanf (" Zs", named); print ("\m The names entexed aze\n"); putt (7 Z5\5", Named )s puatt CZ s\0", name2); priolt (" Zs\n", names); psiatt (7% 5\9", names); getchO fee 3 | output + | Enter four names sabilhi psiya nishitha havshitha The names enteved aye : sahilhi paint then #1 EINES String handling functions = "C language supposts a lasge numbes of stving handling furdion that can be used to cavzy out the many of the stving manipulations like pulting shings togelhen , stoings compace . stving copy... ele \ The following ave the ost of the commonly used | stving handling functions. | 4. stocat QO; Q. tocpyl); | B stlenOs 2 | Fees; oe b- stoing concatenation : ( etecat();) | Tris used to Join two stuings- i Zayntar > etrcat (stat, stv2); 2. sting copy : (stacpy(>;) Tr was almost like a sbing assign operator. Zsyotax> stocpy (sto , v2); | +f e Function with asguments and no wtuwn value | HHindlude jt include | Void protlinec), void add (); Void main() i PBOH ("a Entes hoo numbers"); s@nf ("7d7.d", va, kb); Printline (5); printline (5); getchO; void puotline(int 1) f int i; Bi fox(i=35i<=%; it) paintt ("*"); patoH ("\n"); I; void add Cnt, int y) © iot g= 244 ; print ("Yo Sum =4d", 3) eoUUUIiit tree eedsseddede ry |* Fed factomal of a number using veccussion */ tHindude | # include | iot factCint 0); | Void main ¢ ) | | : int o,f 5 POOH ("10 Enter a number »); | scant ("7% d*, wn); #-fact (m; | PEC Hacienal= 7d) 2), getchO; int tact Cint 5) 1 i SS int a; if (p==41) wetusn 4; else = 0% fact(n-1); acluon x5 2 3 output :- Enter 4 number A faconal = 24 | SUROCTORES. Avvay can be used to vepsesent a quoup of data | items that belongs to same type such as int, float To -wepsesent a collection of data iterns of diffesent | data types a douctuse can be used | | diffevent types The geneval foorat for the stouctuve ts + A ctouctuse 16 a collection of data demerts of Zsyotar > steuct sheuctuse ame i data type member 4 , data type Member 2; data aici» 4 | “* 4 program demonstaating structuse +] | tHodude Mindlude shuct book i chaz name C30) ; chaz tHe Bo]; io pages ; float price ; 33 void maint > ze shuct book b1 ,b2; ('\n Entes authox name, title, pages, puice of book"); 7sisia/dc ", Wb1-name, Wb1. title, wb1. pages, &b4 -price ); paintt (“\n Entex authos came, title, pages, parce of boak2"); s@nt ("757.5/d 7%", &b2.name, &b2.ttle, %b2- pages, ae &b?-poice ); pootf (“\n\o Details of books "); s poott (*\> The autbos name, litle, pages, paice of book : | poott (Io Zs 46 7d 70", bt-name , b4-title, ba. pags, | bi. price ); paott ("\e The author name, title, » parges, poice of book 2+"): putt (In 49 454d 7t" , ba-name, b2-title, ba. ele output +- Entes authos ame , title, pages , psice of books Sabithi psya aq 123 Entes authos name, title, pages, price of book2 Oishilha withika 73 234 Details of books The authox name, ttle , Pages. price of book 4 Sahilhi priya 99 123-000000 The aulhor name, title, pages, price of booka: Nishitha albika 78 oe * Program demonstrating nested etructuse >/ | | Hinclude | | Minclude Binclude | Void mainc 7 z int w=10; int AP; eee pointt (\n Value of x= %d \n ",2); pointt ("\n addvess of x = AU", %%); paintl ("\n adduess of a= %u", p)i puott ("In Value ina= %d", 4p); getch Os is ee Output = Value of 4 = 10 addzess of 1= 6RR24 address of 1= 67b24 Value m x= 10 KK Pnegram dlemonstyating «call by value’ mechanism AJ | thinclude Hinclude Wioclude kept -e- RAM aod CPU Fegis where such a value may Moveoves , a vatiable stovage class tells us Whexe the vasrable would be stowed What there will be inital value of the vavetalcle vif {otal value {8 not specifically iol a=10; void maint) ee -aananeenne FILES. file 13 @ collection of weconcls, A second fields ‘c’ theve (6 NO special mech input and output date. The enly wed to data Is file: Jo pesfown opesations on file following file handing func 4 fopen(? + felose () gete(> pute 0) fpzintt fscavfC) getwcr> putw & again vead the sai ‘tt foto a a called "input" faorn the input fsom the display of the scoee Hlinclude tH include void maint) t Fike * fp 5 chav chs Ix A file named “para’ contains numbers: Code @ parograny to sead this oumber all the odd no. fo a file to be called Opp woite te to be called EVEN: n0-8 toa fi void main f Fine «fa. x fo, eee fot nun if (oun = = - 4) beeak ; 3 putwCoum fA felose (44); i" f = 7p gee Hggs eenasaee 16 Contents povott ("\ while Cum = geo (fa)! é putt (173d ", UD)! 3 £3 = fopen ("ODD", "8"; paint (“10 Contenls of Odd while (Coum = getw(F2))! = FO i paott (" %ad", num); 3 felose (F2); felose (fay getch O;

You might also like