[go: up one dir, main page]

0% found this document useful (0 votes)
4 views17 pages

assignment 1 roll

C programming first year engineering

Uploaded by

mithileshsurve55
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)
4 views17 pages

assignment 1 roll

C programming first year engineering

Uploaded by

mithileshsurve55
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/ 17
Aseryorent FPL Assiqnment: lo-1 QAllwhat is if statement and Nested if ind Explain it in detail with Simple example. =| Y) if Statement. Ta . ecute a block af code ad if cillnmetiigies es gue ST ig rie tes 0 te the i noost basic fom of decision making e ins C- ei o Svntae! SGP Ceanlition is statement 5 * Explanation + —Condition True ae False Sem eme 7 | a - The Thad Value Grue or false) LI the condition ee +o_tiue the block of ‘od ib Hite: cin evaluates to false block of or >| @ veturn 05 e ink main C) 5 & int - num =105 print F (“no istve”)) Shik = Gokhale Education Society's R. H. Sapat Collage of Engineering, Management Studies & Research, Nashik - 5 Gokhale Education Society's R. H. Sapat Collage of Engineering, Management Studies & Research, Nashik - 5 OCUERS ji. 2 loc Gokhale Education Society's R. H. Sapat Collage of Engineering, Management Studies & Research, Nashik - 5 Simple if TF else Else - if - else 2 | Syntax Syntax : winctax. if Ccondition)§ |i? Ccondition) £ 12 Coondition§ statement | tiye Statement | “ Statement % & else & & else i (conditiond 2 UI false_Statement takement2 5 ¥ % else § n Es % 3 |Ut evaluates the Tt evaluates the conditi Fash else if condition ndition ithe i. the condition is true fis, checKed_in Sequence malin is true the Code Inside the The Fisk bs mt the code inside block ex jblock execukes and the theif block. 2 code inside | rest are_sKipeod if no :|£ flse ithe else block condition are true the ho code inside if block! executes ase _blackk executes is ignored | ‘4 epath of lonlyoneo® two ‘only one of the conditio execution exists! blocks Ci? or else will fr ion So ative will executes bagel is check in _s@quence action occurs if] on he Condition unit a tide condition the condition is false) is Found then skip: the yest Gokhale Educati is ication Society's R. H. Sapat Collage of Engineering, Management Studies & Research, Nashik - 5 2 = 105 oO istve\n’): 2 iF (num 70 £Cno is -ve\n’) “no rO\N)5 ued 4 < Value 2°. ‘ode to e ‘ jon & lanagement Studies & Research, Nashik -5 Gokhale Education Society's R. H. Sapat Collage of Engineering, Mi chax wat Ge cies plat + - %1.% i) Gokhale Education Society's R. H. Sapat Collage of Engineering, Management Studies & Research, Nashik - 5, Same (1 CF 3 0p D5 puokE (*' Enter two numbers =) 5 anf (“fd fd” 8a Sb) Switch (oP) Cuse. 4? FC“ ath = %d\n",atb)) bral 3 ICARE ¢~ >. print E Chap» = % d\n", q-b); break + COLO 3h? Print FE C'A*k*h=%d\n” axb): break 5 ef if (bl =0) int EC“ bis 0 @rror)?)5 break 5 CLC bf,J, Pint ECA % b=%d" ak bys else inte (“b iS 0 @ror)”), brea 5 default ; Print F.C’ Error - Tn % keturn 05 % Output : Gokhale Education Society's R. H. Sapat Collage of Engineering, Management Studies & Research, Nashik - 5 Enker opéiator (cae 1, % 1+ IEntey ee shee sok Atb= Q4lhwhat is goto stalemen-explain_with one suitable J Uncori: 2) \t allow ju thin the ame function: ox block €Xample . : ; ; ——] the Goto Statement inc is used 40 Lionsfer control _ ) Syntax * apto label i label's Statement (s) to he exeuuted 4) Explanation « adgoto label : —Tyansr_contiol to the Statemen e b) \abel: L —\abe| is a i i : hich defines a toryet for the goto Statement =The labeled statement can be within the same functio or block , bub not a dif. ‘unctian or'b 5) Consid evation:. ) Styuctuted p¥oayamming While gato can be useful S inj. ec hniqu: Gokhale F: ‘ety’ . ‘okhale F int _main c > jumbes = 10 num = = |o0 “ Thi =m: ton 40 i ion is true_.there ri L exe cuted Gokhale Education Society's R. H. Sapat Collage of Engineering, Management Studies & Research, Nashik - 5 Gokhale Education'Society's R. H. Sapat Collage of Engineering, Management Studies & Research, Nashik - 5 initialization) ‘ondition men / Ls cement emer Ki ondi: in ‘or ch E ion jf tru ode ifs) Re e , then Co: ems Cc ¥emen: Uni jon t false. ¢ 2 ition after h_itesation 2 AES i Og Gokhale Education Society's R. H. Sapat Collage of Engineering, Management Studies & Research, Nashik - 5 Sif the condition i 0 itial e |exec| if the ndition is false | condition is Plage ini tia Pro ude ¢Stdio-h 7 [Hj oh? main cd 5 rg 1 12 123 +h numb Research, Nashik - 5 Gokhale Education Society's R. H. Sapat Collage of Engineering, Management Studies & er umber oF (ines ii ¢ — 5 h, Nashik - 5 lashik - Gokhale Fslucation Society's R. H. Sapat Collage of Engineering, Management Studies & Research, n\ fom \ ne “4 jean. o Gokhale Education Society's R. H. Sapat Collage of Engineering, Management Studies & Research, Nashik - 5 : raw itch (choice LEC“ You se 2. ; a d U3e voli choice \= rn 0} Gokhale Education Society's R. H. Sapat Collage of Engineering, Management Studies & Research, Nashik - 5 Q10 | write a short note an break and continuce =| 1) Break statement The brea Statement _i ° ina’ enclosing loop (fox whilé , do = whil@) ox switch tatement _uncond) tionally USC a break +o exist a loop pexmatare ly besed — on a cextain condition -T+t terminates the loop and yesumes exertution imme diately _afies +he loop +_Sryntax While Ccordition ) § if C some - Condition) § break ; & other Statement % Continue Statement _ continue Statement is vse to ski the bermaining kr statement in current \teralion of loopand jump to dhe | next iteration _ _— — Use Continue to skip {he remaining statement in curent iteration of the cunent itetution ef loop — Tt jumps to next itesation of loop without exectin the Gbsequent Statement Gokhale Education Society's R. H. Sapat Collage of Engineering, Management Studies & Research, Nashik - 5 i=l, ic<=lo, 1% Qe 310, continue (air K an, exe cution _ Nashik - 5 & Research, i ment Studies Gokhale Education Society's R. H. Sapat Collage of Engineering, Manage"

You might also like