Which of the Following is Branching Statement of C Language

Which of the Following is Branching Statement

Which of the Following is Branching Statement of C Language
Which of the Following is Branching Statement of C Language


1.ब्रांचिंग स्टेटमेंट ( Branching Statement)

 विभिन्न स्थितियों के आधार पर निष्पादन के प्रवाह को तय करने के लिए कंडीशनल स्टेटमेंट्स का उपयोग किया जाता है । यदि कोई स्थिति सत्य है , तो एक क्रिया करें और यदि स्थिति असत्य है , तो दूसरी क्रिया करें । जावास्क्रिप्ट में मुख्य रूप से तीन प्रकार के कंडीशनल स्टेटमेंट्स हैं । 

1 ) इफ स्टेटमेंट ( if statement )

 2 ) इफ एल्स स्टेटमेंट ( If Else statement )

 3 ) इफ एल्स इफ एल्स स्टेटमेंट ( If Else If Else statement ) 

2. इफ स्टेटमेंट ( IF statement )

 IF statement एक कंडीशनल ब्रांचिंग स्टेटमेंट है ।IF statement में , यदि कंडीशन सही ( True ) है , तो स्टेटमेंट का एक समूह निष्पादित होता है । और यदि कंडीशन असत्य ( False ) है , तो निम्नलिखित कथनों को छोड़ दिया जाता

 2.सिंटेक्स इफस्टेटमेंट

 If ( condition ) 

{ } // Statement 1 ;

 // Statement 2 ;

 Example

 : : IF स्टेटमेंट के लिए सरल प्रोग्राम 

< html 

 < body >

 < script type = " text / javascript " >

 var num = prompt ( " Enter Number " ) ;

 if ( num > 0 ) { 

alert ( " Given number is Positive !!! " ) ; }

 < / script > 

< / body >

 < / html > 

3. इफ एल्स स्टेटमेंट ( If Else Statement ) 

इफ एल्स दो - तरफा डिसीजन स्टेटमेंट है । इसका उपयोग डिसीजन लेने और स्टेटमेंट को कण्डीशनली निष्पादित करने के लिए किया जाता है । 

सिंटेक्स : इफ - एल्स स्टेटमेंट

 if ( condition )

{ // one Statement or number of statements} 

else

{// one Statement or number of statements } 

उदाहरण :

 Example : 

< html > 

< head >

 < title > If ... Else Statments !!! < / title >

 < script type = " text / javascript " >

 // Get the current hours var hours 

= new Date ( ) . getHours ( ) ;

 if ( hours < 12 )

 document.write ( " Good Morning !!! <br /> " ) ; 

else 

document.write ( " Good Afternoon !!! <br /> " ) ; 

< / script >

 < / head > 

< body > 

< / body > 

< / html >

 4.इफ एल्स इफ एल्स स्टेटमेंट ( If Else If Else statement ) 

इफ एल्स इफ- एल्सस्टेटमेंट का उपयोग दो या दो से अधिक कंडीशंस की जाँच करने के लिए किया जाता है ।

 सिंटेक्स इफएल्सइफ - एल्सस्टेटमेंट 

If ( condition ) { // one , Statementornumberofstatements } elseif ( condition ) 

{ // oneStatementornumberofstatements }

 else 

{ // oneStatementornumberofstatements}

 Example : 

< html > 

< head >

 < script type = " text / javascript " > 

var one prompt ( " Enter the first number " ) ; 

var two prompt ( " Enter the second number " :

var one = prompt ( " Enter the first number " ) ; 

var two = prompt ( " Enter the second number " ) ;

 one = parseInt ( one ) ; 

two = parseInt ( two ) ;

 if ( one == two ) 

document.write ( one + " is equal to " + two + " . " ) ;

 else if ( one < two ) document.write ( one + " is less than " + two + " . " ) ; 

else 

document.write ( one + " is greater than " + two + " . " ) ; 

< / script >

 < / head > 

< body >

 < / body > 

5.स्विच स्टेटमेंट (Switch statement)

स्विच का उपयोग विभिन्न परिस्थितियों पर विभिन्न क्रियाओं को करने के लिए किया जाता है । इसका उपयोग एक ही एक्सप्रेशंस की कई अलग - अलग वैल्यू से तुलना करने के लिए किया जाता है । एक ब्रेक स्टेटमेंट का उपयोग प्रत्येक केस स्टेटमेंट के साथ किया जाता है । 

Syntax Switch statement

 switch ( expression ) { 

case condition 1 : 

// Statements ;

 break ; 

case condition 2 : 

// Statements ; 

break ; 

case condition 3 : 

// Statements ;

 break ;

 case condition n :

 // Statements ; 

break ; default :

 // Statement ;}

 Example Simple Program for Switch Statement

< html > 

< head >

 < script type = " text / javascript " > var day = prompt ( " Enter a number between 1 and 7 " ) ; 

switch ( day )

 {

 case ( day = " 1 " ) :

 document.write ( " Sunday " ) ; 

break ;

 case ( day = " 2 " ) : 

document.write ( " Monday " ) ;

 break ;

 case ( day = " 3 " ) :

 document.write ( " Tuesday " ) ; 

break ; 

case ( day = " 4 " ) : 

document.write ( " Wednesday " ) ; 

break ;

 case ( day = " 5 " ) : 

document.write ( " Thursday " ) ;

 break ; 

case ( day = " 6 " ) : 

document.write ( " Friday " ) ;

 break ; 

case ( day = " 7 " ) :

 document.write ( " Saturday " ) ;

 break ;

 default :

 document.write ( " Invalid Weekday " ) ;

 break ; } 

< / script >

 < / head >

 < / html >

Rohit kushwah

Hello Dosto, Hamare Blog Par Apka Swagat Hai. Mera Name Rohit kushwah Hai Or Ye Computerhindi.in Mera Blog Hai. Hmare Blog Par Apko "Computer" Se Judi Sabhi Jankari Hindi Me Di Jayedi.

Post a Comment

Please Do Not Any Spame Comment

Previous Post Next Post