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

Pattern – Examples (Part-2) in c language in hindi , पैटर्न के उदाहरण c कंप्यूटर भाषा में हिंदी में

पैटर्न के उदाहरण c कंप्यूटर भाषा में हिंदी में , Pattern – Examples (Part-2) in c language in hindi :-
Pattern – Examples (Part-1 ) मे , हमने related उदाहरण को पढ़ा |अब इस article मे कुछ और पैटर्न क उदहारण  को पढ़गे |
उदाहरण -1
Write a program to make blowing pattern.
इस उदहारण मे , नीचे दिए गये पैटर्न को print करने के लिए code को लिखना है |
00100
00100
11111
00100
00100
Explanation :
इस पैटर्न को बनाने के लिए निन्म लॉजिक का पता लगा न होता :
मिड row और मिड column के सभी elements ‘0’ है और बाकि row और column के सभी element ‘1’ है |
1.सबसे पहले,यूजर से row और column की सख्या को input करा लेते है जिसे ‘r’ और ‘c’ मे assign कर देते है |
2.इसके बाद ‘i’ और ‘j’ को declare करते है जिन्हें looping मे use किया जाता है |
3.looping होती है | इसमें दो loops चलाया जाता है |एक row के लिए और दूसरा column के लिए|
Loop मे , जब i की value ‘row/2’ हो या j की value ‘column/2’ हो तब ‘0’ print होगा अन्यथा ‘1’ print होगा |
3. ये loop तब तक चलेगे जब तक की i की value row के सामान नहीं हो जाती है |
Source Code
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,r,c;
printf(“Enter Number of Row :”)
scnaf(“%d”,&r);
printf(“Enter Number of Column :”)
scnaf(“%d”,&c);
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
if((i%2)==0)&& ((j%2)==0))
{
if((i==(r/2))|| (j==(c/2)))
{
printf(“0”);
}
else
{
printf(“1”);
}
}
else if((i==(r+1)/2) || (i==r/2) || (j==(c+1)/2) || (j==c/2) )
{
printf(“1”);
}
else
{
printf(“0”);
}
getch();
}
आउटपुट होगा :
Enter Number of Row : 5
Enter Number of Column : 5
00100
00100
11111
00100
00100
उदाहरण -2
Write a program to make blowing pattern.
इस उदहारण मे , नीचे दिए गये पैटर्न को print करने के लिए code को लिखना है |
010101
101010
010101
101010
010101
Explanation :
इस पैटर्न को बनाने के लिए निन्म लॉजिक का पता लगाना  होता :
1.सबसे पहले,यूजर से row और column की सख्या को input करा लेते है जिसे ‘r’ और ‘c’ मे assign कर देते है |
2.इसके बाद ‘i’ और ‘j’ को declare करते है जिन्हें looping मे use किया जाता है |
3.looping होती है | इसमें दो loops चलाया जाता है |एक row के लिए और दूसरा column के लिए|
Loop मे , जब i की value , सम होती है तब सबसे पहले ‘1’ print होगा और बाद मे ‘0’ print होगा |
और अगर विसम होती तब सबसे पहले ‘0’ print होगा और बस मे ‘1’ print होगा |
3. ये loop तब तक चलेगे जब तक की i की value row के सामान नहीं हो जाती है |
Source Code
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,r,c;
printf(“Enter Number of Row :”)
scnaf(“%d”,&r);
printf(“Enter Number of Column :”)
scnaf(“%d”,&c);
for(i=1:i<=r;i++)
{
if(i %2 ==0 ) {
for(j=1;j<=c;j++)
{
if(j % 2 ==0) {
printf(“1”);
}
else {
printf(“0”);
}
}
else
{
for(j=1;j<=c;j++) {
if(j % 2 != 0)  {
printf(“0”);
}
else  {
printf(“1”);
}
}
}
printf(“\n”);
}
}
getch();
}
आउटपुट होगा :
Enter Number of Row : 5
Enter Number of Column : 5
010101
101010
010101
101010
010101
उदाहरण -3
Write a program to make blowing pattern.
इस उदहारण मे , नीचे दिए गये पैटर्न को print करने के लिए code को लिखना है |
\/\/\
/\/\/
\/\/\
\/\/\
\/\/\
Explanation :
इस पैटर्न को बनाने के लिए निन्म लॉजिक का पता लगाना  होता :
1.सबसे पहले,यूजर से row और column की सख्या को input करा लेते है जिसे ‘r’ और ‘c’ मे assign कर देते है |
2.इसके बाद ‘i’ और ‘j’ को declare करते है जिन्हें looping मे use किया जाता है |
3.looping होती है | इसमें दो loops चलाया जाता है |एक row के लिए और दूसरा column के लिए|
Loop मे , जब i की value , सम होती है तब सबसे पहले ‘\’ print होगा और बाद मे ‘/’ print होगा |
और अगर विसम होती तब सबसे पहले ‘/’ print होगा और बस मे ‘\’ print होगा |
3. ये loop तब तक चलेगे जब तक की i की value row के सामान नहीं हो जाती है |
Source Code
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,r,c;
printf(“Enter Number of Row :”)
scnaf(“%d”,&r);
printf(“Enter Number of Column :”)
scnaf(“%d”,&c);
for(i=1:i<=r;i++)
{
if(i %2 ==0 ) {
for(j=1;j<=c;j++)
{
if(j % 2 ==0) {
printf(“\”);
}
else {
printf(“/”);
}
}
else
{
for(j=1;j<=c;j++) {
if(j % 2 != 0)  {
printf(“/”);
}
else  {
printf(“\”);
}
}
}
printf(“\n”);
}
}
getch();
}
आउटपुट होगा :
Enter Number of Row : 5
Enter Number of Column : 5
\/\/\
/\/\/
\/\/\
\/\/\
\/\/\
उदाहरण -4
Write a program to make blowing pattern.
इस उदहारण मे , नीचे दिए गये पैटर्न को print करने के लिए code को लिखना है |
12345
23456
34567
45678
56789
Explanation :
इस पैटर्न को बनाने के लिए निन्म लॉजिक का पता लगाना  होता :
1.सबसे पहले,यूजर से row और column की सख्या को input करा लेते है जिसे ‘r’ और ‘c’ मे assign कर देते है |
2.इसके बाद ‘i’ और ‘j’ को declare करते है जिन्हें looping मे use किया जाता है |
3.looping होती है | इसमें दो loops चलाया जाता है |एक row के लिए और दूसरा column के लिए|
पहले loop मे , नार्मल parameter pass होते है |
लेकिन दुसरे for loop statement मे ,
initial मे row की value से होगी |
और condition तब तक चलेगा जब तक की j की value ‘i+column’ तक चलेगा |
उसके बाद ‘j’ की value print होगी |
3. ये loop तब तक चलेगे जब तक की i की value row के सामान नहीं हो जाती है |
Source Code
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,r,c;
printf(“Enter Number of Row :”)
scnaf(“%d”,&r);
printf(“Enter Number of Column :”)
scnaf(“%d”,&c);
for(i=1;i<=r;i++)
{
for(j=i;j<=c+i;j++)
{
printf(“%d”,j);
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Number of Row : 5
Enter Number of Column : 5
12345
23456
34567
45678
56789
उदाहरण -5
Write a program to make blowing pattern.
इस उदहारण मे , नीचे दिए गये पैटर्न को print करने के लिए code को लिखना है |
01110
10001
10001
10001
01110
Explanation :
इस पैटर्न को बनाने के लिए निन्म लॉजिक का पता लगाना  होता :
1.सबसे पहले,यूजर से row और column की सख्या को input करा लेते है जिसे ‘r’ और ‘c’ मे assign कर देते है |
2.इसके बाद ‘i’ और ‘j’ को declare करते है जिन्हें looping मे use किया जाता है |
3.looping होती है | इसमें दो loops चलाया जाता है |एक row के लिए और दूसरा column के लिए|
इसमें दो conditions को check की जाती है :-
3.i- first और last row एव first और last column के सभी element ‘1’ होगे  लेकिन
3.ii- बॉक्स के corner पर ‘0’ print होगा |
उसके बाद ‘j’ की value print होगी |
3. ये loop तब तक चलेगे जब तक की i की value row के सामान नहीं हो जाती है |
Source Code
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,r,c;
printf(“Enter Number of Row :”)
scnaf(“%d”,&r);
printf(“Enter Number of Column :”)
scnaf(“%d”,&c);
for(i=1;i<=r;i++)
{
for(j=i;j<=c+i;j++)
{
if((i==1|| i==r ) && (j==1|| j==c ) )
{
printf(“0”);
}
elseif(i==0|| i==r || j==0 || j==c)
{
printf(“1”);
}
else{
printf(“0”);
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Number of Row : 5
Enter Number of Column : 5
01110
10001
10001
10001
01110
Sbistudy

Recent Posts

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

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

3 days ago

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

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

4 days ago

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

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

7 days ago

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

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

7 days ago

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

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

7 days 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