While Loop In C With Example In Hindi :
While Loop In C With Example In Hindi
While Loop को Pretested Loop या Entry Controlled Loop भी कहा जाता हैं क्योंकि इस Loop में सबसे पहले Condition Check होती हैं।
Condition Check होने के बाद , अगर Condition True होती हैं तभी Program का Control , Loop के अंदर Enter करता हैं और Loop Body के अंदर Define सभी Statements को Check कर उनको Run क़रता हैं। और अंत में initial condition के variable को Increment या Decrement से Update कर वापस While Loop में आ जाता हैं।
मगर Condition के False होने पर Program का Control , While Loop के अंदर Enter किये बिना बाहर Exit हो जाता हैं।
यानि दूसरे शब्दों में , While Loop , Loop Body के अंदर Define सभी Statements या Blocks को तब तक लगातार Execute करता हैं जब तक While Loop में Define Condition False न हो जाय।
Syntax –
initial condition ;
while (test_condition)
{
statement 1 ;
statement 2 ;
update of the initial condition;
}
Example 1 .
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr() ;
int x=1 ;
while (x<=10)
{
cout<<x;
x=x+2;
}
cout<<“\n”
}
getch();
}
Example 2.
Write a Program to display Prime Numbers ?
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr() ;
int num , i ;
cin>>num;
i=2 ;
while (i<=num-1)
{
if (num % i == 0)
{
cout<<“It’s not Prime number”;
break;
}
i++;
}
if (i == num)
cout<<“It’s Prime Number”;
}
getch();
}
Example 3.
Write a Program to display Fibonacci Series Or Fibonacci Numbers ?
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr() ;
int a , f=0 , s=1 , t ;
a=0 ;
while (a<=10)
{
t = f+s ;
cout<<t ;
f=s ;
s=t;
a++;
}
getch();
Result-
1 , 2 , 3 , 5 , 8 ,13 , 21 , 34 , 55 , 89 , 144
While Loop In C With Example In Hindi ,
“Switch Case Statement In C In Hindi With Example” , Video को हमारे YouTube channel में देखने के लिए इस Link में Click करें । YouTube channel link – (Padhai Ki Batein / पढाई की बातें)
NOTE – Class 8th , 9th , 10th , 11th , 12th के हिन्दी विषय के सभी Chapters से संबंधित videos हमारे YouTube channel (Padhai Ki Batein / पढाई की बातें) पर भी उपलब्ध हैं। कृपया एक बार अवश्य हमारे YouTube channel पर visit करें । सहयोग के लिए आपका बहुत – बहुत धन्यबाद।
यह भी पढ़ें…
- Nested For Loop In C With Example In Hindi ,
- C और C++ क्या हैं ?
- C या C++ में पहला Program कैसे बनाते हैं ?
- Difference Between If And If Else Statement In C
- 6 Small And Simple Programs For Beginners
- If And If Else Statement in C
- If Else Statement in C
- Nested If Else Statement In C
- Find Out the Largest Value of any given four And Three Numbers in C
- Find Out the Largest Value of any given five Numbers in C
- Logical Operators In C Programming
- For Loop in C Language
- What is HTML Coding
- Web Page कैसे बनाते हैं
- HTML Form
- How To Create Table In Html
- How To Create Hyperlink In HTML
- How To Insert An Image In HTML Page
- Ordered And Unordered List In HTML
- Frame In HTML Coding
- Add Background Color And Image
- Map in HTML
- Nested List In HTML
- How To Create A Website Using HTML Only On Notepad No CSS Used
- How TO Create A Beautiful And Simple WebPage Using HTML Only (No CSS Used)