JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Categories: C Language in hindi

Pattern : Examples ( पार्ट-1 ) in c language in hindi , write pattern program in c language as below example

write pattern program in c language as below example , Pattern : Examples ( पार्ट-1 ) in c language in hindi :-
इस article मे , number pattern के कुछ उदाहरन को देखगे |इस पैटर्न मे number एक special पैटर्न मे print होते है |पैटर्न उदहारण से , प्रोग्रामर की लॉजिक कापाब्लिटी को बढाया जाता है |age आने वाले articles मे हम 30 number पैटर्न के उदहारण को देखेगे |उदाहरण -1
Write a program to print this pattern :
इस उदहारण मे , नीचे दिए पैटर्न को print करने के लिए प्रोग्राम को लिखना है |

Explanation
1.सबसे पहले यूजर से row और column की number को input करा लेते है |
2.फिर उसके बाद दो variable i और j को declare कर लेते है |
3. looping होती है |
इस looping मे दो loop चलते है |जिसमे i और j को use किया जाता है |i row की value define करता है |और j column की value को define करता है |
अगर i की value 2 से डिवाइड होती है तब ‘1’ की line print होती है अन्यथा ‘0’ की line |
4. ये condition जब तक check होती है तब तक i की value , यूजर द्वारा दिए गये रोए number से match नहीं हो जाती है |
source code

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j ;
printf(“Enter Row Number”);
scnaf(“%d”,&r);
printf(“Enter Column Number “);
scnaf(“%d”,&c);
for(i=1;i<=r;i++)
{
for(j=1;j<=c,j++)
{
if((i%2)==0)
{
printf(“0”);
}
else
{
printf(“1”);
}
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Number 4
Enter Column Number 4
1111
0000
1111
0000

उदाहरण -2
Write a program to print this pattern :
इस उदहारण मे , नीचे दिए पैटर्न को print करने के लिए प्रोग्राम को लिखना है |

Explanation
1.सबसे पहले यूजर से row और column की number को input करा लेते है |
2.फिर उसके बाद दो variable i और j को declare कर लेते है |
3. looping होती है |
इस looping मे दो loop चलते है |जिसमे i और j को use किया जाता है | i row की value define करता है |और j column की value को define करता है |
अगर j की value 2 से डिवाइड होती है तब ‘1’ की line print होती है अन्यथा ‘0’ की line |
4. ये condition जब तक check होती है तब तक i की value , यूजर द्वारा दिए गये रोए number से match नहीं हो जाती है |
Source code 
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j ;
printf(“Enter Row Number”);
scnaf(“%d”,&r);
printf(“Enter Column Number “);
scnaf(“%d”,&c);
for(i=1;i<=r;i++)
{
for(j=1;j<=c,j++)
{
if((j%2)==0)
{
printf(“1”);
}
else
{
printf(“0”);
}
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Number 4
Enter Column Number 4
0101
0101
0101
0101

उदाहरण -3
Write a program to print this pattern :
इस उदहारण मे , नीचे दिए पैटर्न को print करने के लिए प्रोग्राम को लिखना है |

Explanation
इस पैटर्न को बनाने के लिए निन्म condition को जानना जरुरी होता है :
1.first or last row मे ‘1’ print होगा |
2.first or last column मे ‘1’ print होगा |
1.सबसे पहले यूजर से row और column की number को input करा लेते है |
2.फिर उसके बाद दो variable i और j को declare कर लेते है |
3. looping होती है |
इस looping मे दो loop चलते है |जिसमे i और j को use किया जाता है | i row की value define करता है |और j column की value को define करता है |
अगर j की value 2 से डिवाइड होती है तब ‘1’ की line print होती है अन्यथा ‘0’ की line |
4. ये condition जब तक check होती है तब तक i की value , यूजर द्वारा दिए गये रोए number से match नहीं हो जाती है |
Source code 
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j ;
printf(“Enter Row Number”);
scnaf(“%d”,&r);
printf(“Enter Column Number “);
scnaf(“%d”,&c);
for(i=1;i<=r;i++)
{
for(j=1;j<=c,j++)
{
if((i==1)||(j==0)||(i==r)||(j==c))
{
printf(“1”);
}
else
{
printf(“0”);
}
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Number 4
Enter Column Number 4
1111
1001
1001
1111

उदाहरण -4
Write a program to print this pattern :
इस उदहारण मे , नीचे दिए पैटर्न को print करने के लिए प्रोग्राम को लिखना है |

Explanation
जब पैटर्न को observe किया तब इस पैटर्न को बनाने के लिए निन्म condition को जानना जरुरी होता है :
जब row और column  के center मे ‘0’ print होगा |


1.सबसे पहले यूजर से row और column की number को input करा लेते है |
2.फिर उसके बाद दो variable i और j को declare कर लेते है |
3. looping होती है |
इस looping मे दो loop चलते है |जिसमे i और j को use किया जाता है | i row की value define करता है |और j column की value को define करता है |
निन्म  conditions मे ‘0’ print होगा :-
(i)जब column के center की value , j के और row के center की value ,i के equal हो
(ii) जब column का 2 से remainder ‘0’ हो और column +1 की value j के equal हो |
4. ये condition जब तक check होती है तब तक i की value , यूजर द्वारा दिए गये रोए number से match नहीं हो जाती है |
Source code 
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j ;
printf(“Enter Row Number”);
scnaf(“%d”,&r);
printf(“Enter Column Number “);
scnaf(“%d”,&c);
for(i=1;i<=r;i++)
{
for(j=1;j<=c,j++)
{
if (rc==i && cc ==j)
{
printf(“0”);
}
elseif(c%2==0 && cc+1 ==j)
printf(“1”);
else
printf(“0”);
}
else
{
printf(“0”);
}
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Number 5
Enter Column Number 5
11111
11111
11011
11111
11111

उदाहरण -5
Write a program to print this pattern :
इस उदहारण मे , नीचे दिए पैटर्न को print करने के लिए प्रोग्राम को लिखना है |

Explanation
1.सबसे पहले यूजर से row और column की number को input करा लेते है |
2.फिर उसके बाद दो variable i और j को declare कर लेते है |
3. looping होती है |
इस looping मे दो loop चलते है |जिसमे i और j को use किया जाता है | i row की value define करता है |और j column की value को define करता है |
i  की value को print कराया  जाता है |
4. ये condition जब तक check होती है तब तक i की value , यूजर द्वारा दिए गये रोए number से match नहीं हो जाती है |
Source code 
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j ;
printf(“Enter Row Number”);
scnaf(“%d”,&r);
printf(“Enter Column Number “);
scnaf(“%d”,&c);
for(i=1;i<=r;i++)
{
for(j=1;j<=c,j++)
{
printf(“%d”, i);
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Number 5
Enter Column Number 5
11111
22222
33333
44444
55555

Sbistudy

Recent Posts

Question Tag Definition in english with examples upsc ssc ias state pcs exames important topic

Question Tag Definition • A question tag is a small question at the end of a…

2 weeks ago

Translation in english grammer in hindi examples Step of Translation (अनुवाद के चरण)

Translation 1. Step of Translation (अनुवाद के चरण) • मूल वाक्य का पता करना और उसकी…

2 weeks ago

Report Writing examples in english grammer How to Write Reports explain Exercise

Report Writing • How to Write Reports • Just as no definite rules can be laid down…

2 weeks ago

Letter writing ,types and their examples in english grammer upsc state pcs class 12 10th

Letter writing • Introduction • Letter writing is an intricate task as it demands meticulous attention, still…

2 weeks ago

विश्व के महाद्वीप की भौगोलिक विशेषताएँ continents of the world and their countries in hindi features

continents of the world and their countries in hindi features विश्व के महाद्वीप की भौगोलिक…

2 weeks ago

भारत के वन्य जीव राष्ट्रीय उद्यान list in hin hindi IAS UPSC

भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…

2 weeks 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