हिंदी माध्यम नोट्स
Pattern : Examples ( पार्ट-1 ) in c language in hindi , write pattern program in c language as below example
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
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
Recent Posts
सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है
सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…
मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the
marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…
राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi
sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…
गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi
gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…
Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन
वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…
polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten
get all types and chapters polity notes pdf in hindi for upsc , SSC ,…