हिंदी माध्यम नोट्स
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
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
C++ : Looping Example , pattern display program of c++ language with explanation
निन्म पैटर्न को display किया जाता है |
*******
*******
*******
*******
*******
*******
*******
Explanation
सबसे पहले किसी पैटर्न को display करने के लिए looping को use किया जाता है |
सबसे पहले दो control variable ‘i’ और ‘j’ को declare किया गया है in variable का use loop को control करने मे किया जाता है |
इसमें second level loop को इसे किया जाता है |
सबसे पहले loop से पैटर्न के row को display किया जाता है | और inner loop से colunm को display किया जाता है |
outer loop यूजर द्वारा input की गयी row size तक चलाया जाता है |
inner loop की body मे ‘*’ display होता है | ये loop तब तक चलता है जब तक colunm size तक नहीं होती है |
inner loop तब तक चलता है जब तक outer loop चलता है |
Source code
#include<iostream.h>
#include<conio.h>
void main()
{
int row , colunm ;
cout<<“Enter Row : “;
cin>>row;
cout<<“Enter colunm : “;
cin>>colunm;
int i,j;
for(i=0;i<row;i++)
{
for(j=0;j<colunm;j++)
{
cout<<“*”;
}
cout<<endl;
}
getch();
}
Pattern 2
निन्म पैटर्न को display किया जाता है |
*******
* *
* *
* *
* *
* *
*******
Explanation
इस पैटर्न को देखा जा सकता है की पातेर्ण के पहली और आखरी row और colunm मे ही ‘*’ को display किया जाता है |
सबसे पहले किसी पैटर्न को display करने के लिए looping को use किया जाता है |
सबसे पहले दो control variable ‘i’ और ‘j’ को declare किया गया है इनvariable का use loop को control करने मे किया जाता है | इद्सके अलावा row और colunm की value को input किया जाता है |इसमें second level loop को इसे किया जाता है |
सबसे पहले loop से पैटर्न के row को display किया जाता है | और inner loop से colunm को display किया जाता है |
outer loop यूजर द्वारा input की गयी row size तक चलाया जाता है |
inner loop की body condition को check किया जाता है |
अगर i और j की value ‘0’ और ‘row’ या ‘0’ और ‘clounm’ होती है तब ‘*’ को print किया जाता है |
ये loop तब तक चलता है जब तक colunm size तक नहीं होती है |
inner loop तब तक चला है जब तक outer loop चलता है |
Source code
#include<iostream.h>
#include<conio.h>
void main()
{
int row , colunm ;
cout<<“Enter Row : “;
cin>>row;
cout<<“Enter colunm : “;
cin>>colunm;
int i,j;
for(i=0;i<row;i++)
{
for(j=0;j<colunm;j++)
{
if(i==0 && i== row || j==0 && j==colunm)
{
cout<<“*”;
}
else
{
cout<<” “;
}
}
cout<<endl;
}
getch();
}
Pattern 3
निन्म पैटर्न को display किया जाता है |
*****
****
***
**
*
Explanation
सबसे पहले किसी पैटर्न को display करने के लिए looping को use किया जाता है |
सबसे पहले row और colunm की value को input किया जाता है |
दो control variable ‘i’ और ‘j’ को declare किया गया है इन variable का use loop को control करने मे किया जाता है | इसमें second level loop को इसे किया जाता है |
सबसे पहले loop से पैटर्न के row को display किया जाता है | और inner loop से colunm को display किया जाता है |
outer loop यूजर द्वारा input की गयी row size तक चलाया जाता है |
inner loop मे j की value , colunm से initial होती है | और ये loop तब तक चलता है जब तक j की value colunm-i से छोटी होती है |
इस loop की body मे ‘*’ display होता है |
inner loop तब तक चला है जब तक outer loop चलता है |
Source code
#include<iostream.h>
#include<conio.h>
void main()
{
int row , colunm ;
cout<<“Enter Row : “;
cin>>row;
cout<<“Enter colunm : “;
cin>>colunm;
int i,j;
for(i=0;i<row;i++)
{
for(j=colunm;j=>colunm-i; j–)
{
cout<<“*”;
}
cout<<endl;
}
getch();
}
Pattern 4
निन्म पैटर्न को display किया जाता है |
*
**
***
****
*****
Expalation
सबसे पहले किसी पैटर्न को display करने के लिए looping को use किया जाता है |
सबसे पहले row और colunm की value को input किया जाता है |
दो control variable ‘i’ और ‘j’ को declare किया गया है इन variable का use loop को control करने मे किया जाता है | इसमें second level loop को इसे किया जाता है |
सबसे पहले loop से पैटर्न के row को display किया जाता है | और inner loop से colunm को display किया जाता है |
outer loop यूजर द्वारा input की गयी row size तक चलाया जाता है |
inner loop मे j की value , ‘0’ से initial होती है | और ये loop तब तक चलता है जब तक j की value i से छोटी या सामान होती है |
इस loop की body मे ‘*’ display होता है |
inner loop तब तक चला है जब तक outer loop चलता है |
Source code
#include<iostream.h>
#include<conio.h>
void main()
{
int row , colunm ;
cout<<“Enter Row : “;
cin>>row;
cout<<“Enter colunm : “;
cin>>colunm;
int i,j;
for(i=0;i<row;i++)
{
for(j=0;j<=i;j++)
{
cout<<“*”;
}
cout<<endl;
}
getch();
}
Pattern 4
निन्म पैटर्न को display किया जाता है |
1
12
123
1234
12345
Expalation
सबसे पहले किसी पैटर्न को display करने के लिए looping को use किया जाता है |
सबसे पहले row और colunm की value को input किया जाता है |
दो control variable ‘i’ और ‘j’ को declare किया गया है इन variable का use loop को control करने मे किया जाता है | इसमें second level loop को इसे किया जाता है |
सबसे पहले loop से पैटर्न के row को display किया जाता है | और inner loop से colunm को display किया जाता है |
outer loop यूजर द्वारा input की गयी row size तक चलाया जाता है |
inner loop मे j की value , ‘1’ से initial होती है | और ये loop तब तक चलता है जब तक j की value i से छोटी या सामान होती है |
इस loop की body मे ‘i’ की value को display होता है |
inner loop तब तक चला है जब तक outer loop चलता है |
Source code
#include<iostream.h>
#include<conio.h>
void main()
{
int row , colunm ;
cout<<“Enter Row : “;
cin>>row;
cout<<“Enter colunm : “;
cin>>colunm;
int i,j;
for(i=0;i<row;i++)
{
for(j=0;j<=i;j++)
{
cout<<i;
}
cout<<endl;
}
getch();
}
Recent Posts
द्वितीय कोटि के अवकल समीकरण तथा विशिष्ट फलन क्या हैं differential equations of second order and special functions in hindi
अध्याय - द्वितीय कोटि के अवकल समीकरण तथा विशिष्ट फलन (Differential Equations of Second Order…
नियत वेग से गतिशील बिन्दुवत आवेश का विद्युत क्षेत्र ELECTRIC FIELD OF A POINT CHARGE MOVING WITH CONSTANT VELOCITY in hindi
ELECTRIC FIELD OF A POINT CHARGE MOVING WITH CONSTANT VELOCITY in hindi नियत वेग से…
four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं
चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…
Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा
आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…
pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए
युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…
THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा
देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…