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

C++ : Do-While or While Loop in hindi , what is do while and while loop in c++ language with program example

what is do while and while loop in c++ language with program example , C++ : Do-While or While Loop in hindi :-
इससे पहले के article मे , for loop के बारे मे discuss किया है अब इस article मे while और do-while loop को discuss करते है |
While loop
while loop के syntax मे initial और update statement को नहीं लिखा जाता है | इसमें केवल test condition को लिखा जाता है | इसका syntax होता है :-
while(test condition)
{
body ;
}
इस syntax मे initial को while loop के बहार लिखा जाता है | और update statement को loop की body मे लिखा जाता है |
सबसे test condition को check किया जाता है | अगर test condition true होती है तब  loop की body को execute किया जाता है |
इस loop body मे केवल एक statement होता है तब {} को use करना complusy नहीं होता है | लेकिन एक statement से ज्यादा statements होता है तब {} को use करना चाहिए |
जब इस body execute हो जाती तब loop का control while loop की start मे आ जाता है | फिर से condition check की जाती है | अगर condition true होती है तब loop की body फिर execute हो जाती है |
ये प्रोसेस तब तक चलती है जब तक condition true होती रहती है |
अगर किसी loop को terminate करना होता है तब test condition को इसी तरह से set किया जाता है |
While loop entry level loop है जिसका मतलब है की अगर loop की condition को false होगी तो loop की body एक बार भी execute नहीं होता है |
इसका उदाहरन होता है :
#include<iostream.h>
#include<conio.h>
void main()
{
int mul,number ;
int i = 1;
cout<<“Enter number : “<<endl;
cin>>number;
cout<< “Table of “<<number<<endl;
while(i<=10)
{
mul=number*i;
cout<<number <<“*”<< i <<“=”<< mul<<endl;
i++;
}
getch();
}
इस article मे , while loop से table को print  किया जाता है | इसके लिए :-
सबसे पहले i को 1 से initial किया जाता है | और while loop मे condition i<=10 को check करते है | और loop की body मे i की value को increment किया जाता है | यूजर द्वारा input किया गया value ‘2’ है |
तब i = 1 है तब mul = 2 होगा |
तब i = 2 है तब mul = 4 होगा |
तब i = 3 है तब mul = 6 होगा |
तब i = 4 है तब mul = 8 होगा |
तब i = 5 है तब mul = 10 होगा |
ये loop तब तक चलता है जब तक i की value 10 नहीं हो जाती है |
इसका आउटपुट होगा :-
Enter number : 4
Table of 4
4*1=4
4*2=8
4*3=12
4*4=16
4*5=20
4*6=24
4*7=28
4*8=32
4*9=36
4*10=40Do-While loop
Do while loop के syntax मे initial और update statement को नहीं लिखा जाता है | और Do while loop के statement को body के बाद लिखा जाता है | इसमें केवल test condition को लिखा जाता है | इसका syntax होता है :-
{
body ;
}
do while(test condition)
इस syntax मे initial को do while loop के बहार लिखा जाता है | और update statement को loop की body मे लिखा जाता है |
सबसे पहले loop की body perform होती है फिर loop की condition check की जाती है |
वwhile loop की तरह , अगर  loop body मे केवल एक statement होता है तब {} को use करना complusy नहीं होता है | लेकिन एक statement से ज्यादा statements होता है तब {} को use करना चाहिए |
जब इस body एक बार perform हो जाती तब loop का condition check की जाती है | condition के true होने पर body को perform किया जाता है | फिर से condition को check किया जाता है | ये प्रोसेस तब तक चलती है जब तक condition true होती रहती है |
अगर किसी loop को terminate करना होता है तब test condition को इसी तरह से set किया जाता है |
Do-While loop ending level loop है जिसका मतलब है की loop की body एक बार तो perform होती है | उसके बाद condition को check की जाती है |
इसका उदाहरन होता है :
#include<iostream.h>
#include<conio.h>
void main()
{
int mul,number ;
int i = 1;
cout<<“Enter number : “<<endl;
cin>>number;
cout<< “Table of “<<number<<endl;
{
mul=number * i;
cout<<number <<“*”<< i <<“=”<< mul<<endl;
i++;
}
do while (i<=10);
getch();
}
इस article मे , do-while loop से table को print  किया जाता है | इसके लिए :-
सबसे पहले i को 1 से initial किया जाता है | और loop की body मे  table की first row को print किया जाता है | उसके बाद i की value को increment किया जाता है | फिर condition check की जाती है | अगर यूजर द्वारा input किया गया value ‘2’ है |
तब i = 1 है तब mul = 2 होगा | इसके बाद i की value increment किया जाता है |
तब i = 2 है तब mul = 4 होगा |इसके बाद i की value increment किया जाता है |
तब i = 3 है तब mul = 6 होगा |इसके बाद i की value increment किया जाता है |
तब i = 4 है तब mul = 8 होगा |इसके बाद i की value increment किया जाता है |
तब i = 5 है तब mul = 10 होगा |इसके बाद i की value increment किया जाता है |
ये loop तब तक चलता है जब तक i की value 10 नहीं हो जाती है |
इसका आउटपुट होगा :-
Enter number : 4
Table of 4
4*1=4
4*2=8
4*3=12
4*4=16
4*5=20
4*6=24
4*7=28
4*8=32
4*9=36
4*10=40इस article मे while और do-while loop को discuss किया है अब आगे के article मे while और do-while loop के उदाहरनो को discuss करेगे |
Sbistudy

Recent Posts

द्वितीय कोटि के अवकल समीकरण तथा विशिष्ट फलन क्या हैं differential equations of second order and special functions in hindi

अध्याय - द्वितीय कोटि के अवकल समीकरण तथा विशिष्ट फलन (Differential Equations of Second Order…

17 hours ago

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

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

4 days ago

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

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

5 days ago

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

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

1 week ago

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

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

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