Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 94 - Math_Genius_1 2
P. 94

    if...else LVsVesaV  (if...else Statement)
                      if….else LVsVesaV osQ CykWd esa ls fdlh ,d dks fu"ikfnr djus osQ fy, ç;ksx fd;k tkrk gS vxj ;k vU; c;kuksa lsA
                      tc dhoMZ osQ vkxs dh fLFkfr dk ewY;kadu lgh gksrk gS] rks if block LVsVesaV fu"ikfnr fd;k tk,xkA vU;Fkk] vU;
                      block osQ uhps fn, x, dFkuksa dks fu"ikfnr fd;k tk,xkA

                      if….else LVsVesaV dk flaVSDl gS%
                      if < conditional expression >:

                             [statements]
                                                                                        VsLV       vlR;
                      else:                                                                                   else ckWMh
                                                                                       ,Dizs'ku
                             [statements]
                      mnkgj.k osQ fy,]
                                                                                            lR;

                                                                                        if ckWMh

                                                                                           if...else LVsVesaV dk ÝykspkVZ
                                                                                       (Flowchart of if ... else statement)

                      if...else LVsVesaV dk mi;ksx (Using if...else statement)
                      tSlk fd vkius fiNys mnkgj.k esa fd;k Fkk] çksxzke dks Øe'k%
                      22 vkSj 7 osQ ekuksa osQ fy, nks ckj pyk,¡A tc vki 22
                      ntZ djrs gSa rks 'krZ (22» 2 ¾¾ 0) lgh gks tkrh gSA rks]
                      vkmViqV gS%

                      The number is even
                      Thank You!
                      tc vki eku 7 ntZ djrs gSa] rks vkmViqV gksrk gS%
                      The number is odd
                                                                                              vkmViqV (Output)
                      Thank You!
                      ,slk blfy, gS D;ksafd vxj dhoMZ osQ lkFk oaQMh'ku (7» 2 ¾¾ 0) xyr gS] rks fu;a=k.k vU; CykWd esa LVsVesaV~l
                      ij tkrk gSA

                      if...elif...else LVsVesaV (if...elif...else Statement)
                      ;g LVsVesaV gesa dbZ fLFkfr;ksa dk ijh{k.k djus vkSj LVsVesaV~l osQ dbZ CykWdksa esa ls ,d dks fu"ikfnr djus esa enn
                      djrk gSA if---elif---else lajpuk esa] elif LVsVesaV dh dksbZ Hkh la[;k gks ldrh gS] ysfdu osQoy ,d vU; LVsVesaV gks
                      ldrk gSA ;s CykWd ^if*] ^elif* vkSj ^else* dhoMZ }kjk fu£n"V fd, tkrs gSaA if---elif---else LVsVesaV dk flaVSDl gS%

                      if < conditional expression >:
                             [statements]
                      elif< conditional expression >:
                             [statements]

                      else:
                             [statements]

                         92  Play (Ver. 1.0)-VIII

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