Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 95 - Math_Genius_1 2
P. 95

    mnkgj.k osQ fy,]

                                           if...elif...else LVsVesaV dk mi;ksx djuk (Using if...elif...else statement)
                     bl çksxzke dks Øe'k% w, r, s, t buiqV osQ lkFk pkj ckj pyk,¡A
                     vki vkmViqV dks Øe'k% 'Winter'] 'Rainy'] 'Summer'
                     vkSj  'Wrong Code'  osQ  :i  esa  ns•saxsA  ,slk  blfy,  gS
                     D;ksafd gj ckj oaQMh'ku dks if vkSj elif dhoMZ osQ ckn fy•s
                     x, oaQfM'kuy ,Dlçs'ku ls psd fd;k tkrk gS vkSj vkmViqV
                     ml CykWd esa fy•k gqvk LVsVesaV nsrk gS] tgk¡ ijiQsDV eSp
                     feyrk gSA

                         ywfiax LVsVesaV (Looping Statements)
                     ywfiax LVsVesaV gesa funZs'kksa osQ ,d lsV dks ,d fuf'pr la[;k        vkmViqV (Output)
                     esa nksgjkus dh vuqefr nsrk gSA bls iqujko`fÙk LVsVesaV (iteration statement) Hkh dgk tkrk gSA ik;Fku nks çdkj osQ
                     ywfiax LVsVesaV çnku djrk gS tksfd for vkSj while gSaA gkyk¡fd] for ywi dk iz;ksx while ywi dh rqyuk esa lkekU;r%

                     vf/d fd;k tkrk gSA vkb,] ywi osQ ckjs esa foLrkj ls tkusaA

                     iQkWj ywi (for Loop)
                     ik;Fku esa for ywi osQ fy, fuf'pr la[;k esa LVsVesaV osQ ,d lsV             vkjaHk
                     dks nksgjkus esa enn feyrh gSA ;g fdlh Hkh Øe dh oLrqvksa dks
                     ,d&,d djosQ lalkf/r (process) djus osQ fy, fM”kkbu fd;k                 for vkbVe Øe%
                     x;k gSA
                     ywi osQ fy, flaVSDl gS%                                                    ijh{k.k

                     for <variable> in <set of values>:
                            [statements to repeat]                                vxyk           flDo-             gk¡
                     osfj,cy ,d ywi osfj,cy gS] tks for ywi iqujko`fÙk;ksa dks fu;af=kr         [kkyh gS
                     djrk gSA dhoMZ osQ ckn fy•s x, ekuksa dk lsV mu rRoksa dk Øe
                     gS] tgk¡ ls ywi ckWMh esa fy•s x, LVsVesaV~l dks nksgjkrs gq, osfj,cy
                     viuk ewY; çkIr djsxkA                                                        ugha             #dks

                                                                                              LVsVesaV CykWd

                                                                                    for ywi dk ÝykspkVZ (Flowchart of for loop)

                                          for ywi dk mi;ksx djuk (Using for Loop)
                                                                              ikbFku esa oaQfM'kuy vkSj ywfiax LVsVesaV~l  93

| 90 91 92 93 94 95 96 97 98 99 100 |