JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi sociology physics physical education maths english economics geography History

chemistry business studies biology accountancy political science

Class 12

Hindi physics physical education maths english economics

chemistry business studies biology accountancy Political science History sociology

Home science Geography

English medium Notes

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Class 12

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Categories: C Language in hindi

Decision Making Tools : Swich or goto statement in hindi in c language स्विच और गोटू स्टेटमेंट

स्विच और गोटू स्टेटमेंट Decision Making Tools : Swich or goto statement in hindi in c language :-
जैसे-जैसे conditions बढती है वैसे वैसे if else structure की complexity बढती जाती है | और प्रोग्राम को पढना और समझना मुश्किल हो जाता है लेकिनं C language दो statements की facility दी है :-
Switch Statement :
Switch statement एक multiway decision statement है |switch statement किसी expression को check करता है उस expression के मिलने वाले constant और integer के अनुसार blocks (Group of statements) execute हो जाता है |इस struture निन्म है :-
switch(expression)
{
case value 1:
      block 1;
      break;
case value 2:
      block 2;
      break;
……………….
……………….
……………….
case value n:
   block n;
   break;
}
Statement ;
इस syntax मे expression का आउटपुट constant और integer और character हो सकता है | ये आउटपुट value 1,value 2,……………………..value n होता  है |
Break statement उस switch statement मे block को terminate करने के लिए किया जाता है |इसके अलावा default block होता है जो  expression के आउटपुट को किसी भी case value से ना मिलने पर execute होता है|
उदहारण के लिए :
#include <conio.h>
void main ()
{
int a,b,c;
float Avg;
printf(“Enter your four subject martks = /n”)  ;
scanf(“%d %d %d %d”,&a,&b,&c,&d) ;
Avg = (a+b+c+d)/4;
switch((int)Avg/10)
{
case 10:
case 9:
case 8:
printf(“Honours”);
break;
case 7:
case 6:
printf(“First division”);
break;
case 5:
printf(“Second division”);
case 4:
case 3:
printf(“Third division”);
default:
printf(“Fail”);
}
}
इस उदाहरण मे चार subject के मार्क्स के averge को Avg मे assign हो जाता है जिसका data type float है | switch मे यूज़ करने के लिए Avg को data type को type casting से integer मे convert किया जाता है |
अगर Avg की value 10,9,8 है तब  Honours होगा |
जब Avg की value 7,6 होगी तब First division होगा |
जब Avg की value 5 होगी तब Second division होगा |
जब Avg की value 3,4 होगी तब Third division होगा |
default value मे Fail message आयेगे |
आउटपुट होगा :-
Enter your four subject marks =
85 66 67 89
First division
Switch statement के rule:
1. switch expression का आउटपुट integral हो चाहिए|
2.case lable unique होने चाहिए|
3.switch statement मे केवल एक default block हो सकता है |
4.case label ऑप्शनल है |

go to Statement :

सब किसी प्रोग्राम मे किसी block (Group of Statements) को बार बार  repeat करना होता है  tab इस statement का use हो जाता है |
goto statement मे name  की जरुरत होती है name उस block का नाम है जिसे प्रोग्रामर को repeat करना है |ये statement दो प्रकार से इस्तेमाल करता है |
1.BACKWARD JUMP Looping:
अगर EXECUTION BLOCK goto statement से पहले है और condition check होने के बाद EXECUTION BLOCK repeat होता है | इसका STRUCTURE है :-
read  name :
  block statements;
  ………………………;
  ………………………;
if (condition)
goto name ;
2.FORWARD JUMP looping :
जब EXECUTION BLOCK goto statement के बाद होता है और condition पहले check होती और बाद मे EXECUTION BLOCK execute होता है |
if (condition)
goto name;
statement  ;
……………..;
read  name :
  block statements;
  ………………………;
  ………………………;
उदहारण के लिए :
इस उदहारण मे हम tabel print करायेगे|
#include <conio.h>
void main ()
{
int a=0;
int table ;
printf(“Enter your number”);
scanf(“%d”,&table)
int mul;
read code:
a=a+1;
mul=a*table;
printf(“a*table=%d”,mul);
if(a<=10)
goto code;
}
इस उदहारण मे backward jump मे होता है |जिसमे प्रोग्रामर द्वारा code block statements तब तक repeat होता है जब तक a की value 0 से 10 तक नहीं हो जाती है |
आउटपुट होगा :-
Enter your number 2
2*1=2
2*2=4
2*3=6
2*4=8
2*5=10
2*6=12
2*7=14
2*8=16
2*9=18
2*10=20
Sbistudy

Recent Posts

four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं

चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…

1 day ago

Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा

आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…

3 days ago

pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए

युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…

5 days ago

THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा

देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…

5 days ago

elastic collision of two particles in hindi definition formula दो कणों की अप्रत्यास्थ टक्कर क्या है

दो कणों की अप्रत्यास्थ टक्कर क्या है elastic collision of two particles in hindi definition…

5 days ago

FOURIER SERIES OF SAWTOOTH WAVE in hindi आरादंती तरंग की फूरिये श्रेणी क्या है चित्र सहित

आरादंती तरंग की फूरिये श्रेणी क्या है चित्र सहित FOURIER SERIES OF SAWTOOTH WAVE in…

1 week ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now