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

Looping in c language in hindi , loops , while , do – while loop , for looping लूप c भाषा में

लूप c भाषा में Looping in c language in hindi , loops , while , do – while loop , for looping :-
इससे पहले goto statement से किसी प्रोग्राम segment को बार बार repeat कर सकते है |लेकिन इसका structure बहुत complex होने पर प्रोग्रम्म की complexity मो बढ़ा देता है |C LANGUAGE मे ,goto statement  के अलावा ,LOOPING की सुविधा भी देता है | LOOPING दो तरह की होती है :-
1.ENTRY CONTROL LOOP:
इस प्रकार मे, control statement looping के शुरुवात मे होती है |अगर condition true नहीं होती है तब LOOP का block execute नहीं होता है |
2.EXIT CONTROL LOOP:
इस प्रकार मे, control statement execute block के बाद होता है | अगर condition true नहीं होती है तब LOOP का block execute एक बार होता है |
किसी भी looping मे control statement बहुत carefully बनाना चाहिए |क्योकि loop का control पूरी तरह condition पर निर्भर करता है |loop मे ,चार प्रकार के operations होते है :-
1.Control variable को set करना |
2.Loop statement को execute करना |
3.Condition को टेस्ट करना |
4.Condition variable को increment करना है |
C language मे तीन looping होती है :-

1. while loop:

While loop entry controlled loop है |इसमें test condition loop के start मे होती है |अगर ये test condition true होती है तब block execute होता है फिर control variable मे increment होता है और condition फिर check होती है |
अगर condition false हो जाती है तब loop block execute नहीं होता है |
इसका syntax है :-
while(condition)
{

 

block statement ;

 

control variable increment;
}
उदहारण :
#include<conio.h>
#include<stdio.h>
void main ()
{

 

int a,mul;

 

int i =1;
printf(“Enter your digit”);
scanf(“%d”,&a);
whille (i<=10)
{

 

mul=a*i;

 

printf(“%d”,mul);
i++;
}
}
इस उदहारण मे , प्रोग्रामर table print हो रहा है | जब तक i की value 10 नहीं हो जाएगी तब तक block statement execute होगा |
आउटपुट होगा :
Enter your digit 2
2 4 6 8 10 12 14 16 18 20

2. do – while loop:

ये loop exit control loop है |इसमें execute body condition check होने से पहले execute होती है |इसका मतलब है loop body एक बार तो execute तो होगी |इसका syntax है :-
do
{
statements;
control variable increment;
}
while(condition);
इसमें body execute होने के बाद , control variable में increment होता है |फिर condition check होती है |अगर condition true होती है तब loop body फिर से execute होती है |
उदाहरण के लिए :
#include<conio.h>
#include<stdio.h>
void main ()
{

 

int a,mul;

 

int i =1;
printf(“Enter your digit”);
scanf(“%d”,&a);
do
{

 

mul=a*i;

 

printf(“%d”,mul);
i++;
}
whille (i<=10);
}
इस उदाहर मे भी table print होगा लेकिन इसमें एक बार printf statement execute हो जायेगे |बाद initialing और condition check होगा |
आउटपुट होगा :
Enter your digit 3
3 6 9 12 15 18 21 24 27 30
उदहारण -2:
#include<conio.h>
#include<stdio.h>
void main ()
{
int sum,a,b ;
sum=3;
printf(“Enter your digit”);
scanf(“%d %d”,&a,&b);
do
{
sum=a+b;
printf(“Your Sum = %d”,sum);
a=a+1;
b=b+2;
}
while((sum/2)==0);
}
इस प्रोग्राम मे sum की value 3 है ,फिर भी a और b का addition एक बार perform होगा |फिर sum/2==0 check होगा |और condition सही होने पर , block execute होगा |
आउटपुट होगा :
Enter your digit 22 12
Your Sum = 34
Your Sum = 37
अब condition true नहीं होने पर , loop block execute नहीं होगा |

3. for looping:

for loop entry controlled loop है | while और do-while loop का syntax complex होता है लेकिन for loop के syntax सरल और आसानी से समजा सकता है|इसका syntax है :-\
for(initial ; condition ;  increment )
{
statements;
}
initial : control variable को initial  करना |
condition : इसमें control expression को check करना |
increment : इसमें control variable का increment करना |
उदहारण के लिए :
#include<conio.h>
#include<stdio.h>
void main ()
{

 

int a,mul,i;

 

printf(“Enter your digit”);
scanf(“%d”,&a);
for(i=1;i<=10;i++)
{
mul=a*i;
printf(“%d”,mul);
}
}
इस उदहारण मे भी , table print हो रहा है | जब तक i की value 10 नहीं हो जाएगी तब तक block statement execute होगा |
आउटपुट होगा :
Enter your digit 2
2 4 6 8 10 12 14 16 18 20
Sbistudy

Recent Posts

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

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

23 hours 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