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 : Difficult Excises in c language in hindi , pattern examples in c programs in computer programming

pattern examples in c programs in computer programming , Pattern : Difficult Excises in c language in hindi :-
इस article मे , पैटर्न के मुश्किल उदाहरण को देखेगे|अगर आन्पे हमारे पैटर्न के पहले वाले article को नहीं पढ़ा तो इस article की Excise को solve’ करने से पहले उन article को जरुर पढ़ा ले |
उदहारण -1 :
Write a program to print below pattern.
input: 2 4 5 6 7 8
pattern :
245678
45678
5678
678
78
8Explanation
1.सबसे पहले यूजर से pattern के लिए digits  को input करा लेते है | जिसे array मे insert करा लेते है |
2.उसके बाद count () function से array की length को calculate करते है जिसे length variable मे assign करते है |
3.Loop चलाया जाता है जिसमे i को 1 से initial किया जाता है|
array के element को print करा लेते है |
4. loop  तब तक चलेगा जब तक i की value  length तक नहीं होती है |Source code
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j ;
int a[20];
printf(“Enter digits”);
for()
for(i=0;i<20;i++)
{
scanf(“%d”,&a[i]);
}
int length = count(a);
for(i=0;i<length;i++)
{
for(j=i;j<length;j++)
{
printf(“%d”,a[j]);
}
printf(“\n”);
}
getch();
}int count(int c[ ])
{
int k;
int count =0;
for(k=0;k<20;k++)
{
if(c[k]==’ ‘)
{
return (count);
}
else
{
count++;
}
}
return (count) ;
}

आउटपुट होगा :
Enter digits 2 4 5 6 7 8
245678
45678
5678
678
78
8

उदहारण -2 :
Write a program to print below pattern.
Enter Number : 23456
23456
3456
456
56
6
Explanation
1. सबसे पहले , number को input करते है जिसे number variable मे assign कर देते है |
2. for loop चलाया जाता है :-
number की last डिजिट को eliminate कर देते है |
3. loop तब तक चलाया जाता है जबतक की number की value ‘0’ नहीं हो जाती है |

Source code
#include<stdio.h>
#include<conio.h>
void main()
{
int number ;
printf(“Enter Number”);
scanf(“%d”,&number );
for( n=number ; n!=0 ; number = number /10 )
{
printf(“%d\n”,n);
}
getch()
}आउटपुट होगा :
Enter Number 123345
123345
12334
1233
123
12
1

उदहारण -3 :
Write a program to print below pattern.
1
3    2
4    5   6
10  9   8   7
11 12 13 14 15

Explanation
1.सबसे पहले यूजर से row और column की number को input करा लेते है |
2.फिर उसके बाद दो variable i और j को declare कर लेते है |
3.Loop 1 चलाया जाता है जिसमे i को 1 से initial किया जाता है|

 

अगर i की value सम होती है तब k की value , k+1 होगी |अन्यथा k+i होगी
inner loop मे , k की value print होगी |
अगर i की value सम होती तब k की value मे increment होगा अन्यथा decreament होगा |
inner loop तब तक चलेगा जब तक j की value i के सामान नहीं हो जाती है |
4. loop 1 तब तक चलेगा जब तक i की वाले row तक नहीं होती है |
Source code
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j ;
int c,r;
printf(“Enter Row Number”);
scnaf(“%d”,&r);
printf(“Enter Column Number “);
scnaf(“%d”,&c);
for(i=1;i<=r;i++)
{
if((i%2)==0)
{
k=k+1;
}
else
{
k-=k+i;
}
for(j=1;j<=i,j++)
{
printf(“%d”, k);

if((i%2)==0)
{
k=k++;
}
else
{
k-=k–;
}

}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Number 4
Enter Column Number 4
1
3    2
4    5   6
10  9   8   7
उदहारण -4 :
Write a program to print below pattern.
1

22
333
4444
33333
222222
11111111

Explanation
1.सबसे पहले यूजर से row और column की number को input करा लेते है |
2.फिर उसके बाद दो variable i और j को declare कर लेते है |
3.Loop 1 चलाया जाता है जिसमे i को 1 से initial किया जाता है|
अगर i की value , number of row /2 से छोटी होती है तब inner loop मे , i+1 की value print होती है
अन्यथा n-i+1 की value print होती है |
inner loop तब तक चलेगा जब तक j की value i के सामान नहीं हो जाती है |
4. loop 1 तब तक चलेगा जब तक i की वाले row तक नहीं होती है |Source code
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j ;
int c,r;
printf(“Enter Row Number”);
scnaf(“%d”,&r);
printf(“Enter Column Number “);
scnaf(“%d”,&c);
for(i=1;i<=r;i++)
{
if(i<=r/2)
{
for(j=1;j<=i,j++)
{
printf(“%d”, i+1);
}
}
else
{
for(j=0;j<=i;j++)
{
printf(“%d , r-i+1);
}
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Number 7
Enter Column Number 7
1
22
333
4444
33333
222222
11111111
उदहारण -5 :
Write a program to print below pattern.
1

2  7
3  8  12
4  9  13  16
5 10 14  17  19
6 11 15  18  20 21

Explanation
1.सबसे पहले यूजर से row और column की number को input करा लेते है |
2.फिर उसके बाद दो variable i और j को declare कर लेते है | इसके अलावा , दूसरा variable ‘k’ को declare करते है |इसके अलावा , एक और variable ‘num’ को भी declare करते है |
3.Loop 1 चलाया जाता है जिसमे i को 1 से initial किया जाता है| और k की value को ‘i’ से initial करते है |
num की value r-1 से initial होती है |
inner loop मे , k की value print होती है |और ककी value मे value + num से increment होगा |
और num मे ‘1’ से decrement हो जायेगा |
inner loop तब तक चलेगा जब तक j की value i के सामान नहीं हो जाती है |
4. loop 1 तब तक चलेगा जब तक i की वाले row तक नहीं होती है |Source code
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,num;
int c,r;
printf(“Enter Row Number”);
scnaf(“%d”,&r);
printf(“Enter Column Number “);
scnaf(“%d”,&c);
for(i=1;i<=r;i++)
{
num=r-1;
k=i;
for(j=1;j<=i;j++)
{
printf(“%d”,k);
k=k+num;
num–;
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Number 6
Enter Column Number 6
1
2  7
3  8  12
4  9  13  16
5 10 14  17  19
6 11 15  18  20 21
उदहारण -6 :
Write a program to print below pattern.
2
242
24642
2468642Explanation
1.सबसे पहले यूजर से row की number को input करा लेते है |
2.फिर उसके बाद दो variable i और j को declare कर लेते है |
3.दो inner loop चलाया जाता है |
पहले inner loop मे , j की value ‘2’ से initial करते है | और ‘2’ से increment करते है क्योकि सम number print करना है |इस ‘j’ की value को print करा लेते है |ये loop tan तक चलता है जब की j की value i*2 नहीं हो जाती है |इस inner loop से निन्म पैटर्न print होता है |
2
24
246
2468

दुसरे inner loop मे , j को (i-1)*2 से initial करते है |और ‘2’ से decrements होता है |ये loop तब तक चालत है जब तक j की value ‘2’ नहीं हो जाती है |इअमे भी ‘j’ की value print होती है |

Source code
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,num;
int c,r;
printf(“Enter Row Number”);
scnaf(“%d”,&r);
for(i=1;i<=r;i++)
{
for(j=2;j<=i*2;i=i+2)
{
printf(“%d”,j);
}
for(j=(i-1)*2;j>=2;j=j-2)
{
printf(“%d”,j);
}}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Number 4
2
242
24642
2468642
Sbistudy

Recent Posts

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

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

2 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