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

Star Pattern : Examples , Square Pattern , Explanation and source code in c language program in hindi

Explanation and source code in c language program in hindi , Star Pattern : Examples , Square Pattern :-
इससे पहले article मे , number पैटर्न को discuss किया है अब इस article मे , star पैटर्न को discuss करेगे |जो की concept building करता है |प्रोग्रामर को problem के solution को किस तरह से find करना है |और कैसे इसे प्रोग्राम मे ट्रांसलेट करना है |
Square Pattern
write a program to print square pattern.
*****
*****
*****
*****
*****
Explanation
1.सबसे पहले यूजर से row और column के number को input करा लेते है |
2.उसके बाद looping होती है जिसमे दो loops होते है|
3.outer loop मे , ‘i’ की value ‘1’ से initial होती | ये loop तब तक चलते है जब तक इसकी value ‘row’ से छोटी या सामान हो |
4.inner loop मे , j की value ‘1’ से initial होती है | ये loop तब तक चलता है जब तक इसकी value ‘column’ से छोटी या सामान हो |
इस loop की body मे , “*” को print करते है |
Source Code
#include<stdio.h>
#include<conio.h>
void main()
{
int i , j ;
int row , column;
printf(“Enter Row Size”);
scanf(“%d”,&row);
printf(“Enter Colunm Size”);
scanf(“%d”,&column);
for(i=0;i<row;i++)
{
for(j=0;j<colunm;j++)
{
printf(“*”);
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Size 5
Enter Colunm Size 5
*****
*****
*****
*****
*****
Hollow Pattern
write a program to print hollow pattern.
*****
*      *
*      *
*      *
*****
Explanation
1.सबसे पहले यूजर से row और column के number को input करा लेते है |
2.उसके बाद looping होती है जिसमे दो loops होते है|
3.outer loop मे , ‘i’ की value ‘1’ से initial होती | ये loop तब तक चलते है जब तक इसकी value ‘row’ से छोटी या सामान हो |
4.inner loop मे , j की value ‘1’ से initial होती है | ये loop तब तक चलता है जब तक इसकी value ‘column’ से छोटी या सामान हो |
इस loop की body मे , जब i=1 और i=row और j=1 और j=colunm के सामान होती है तब “*” print होगा |
Source Code
#include<stdio.h>
#include<conio.h>
void main()
{
int i , j ;
int row , column;
printf(“Enter Row Size”);
scanf(“%d”,&row);
printf(“Enter Colunm Size”);
scanf(“%d”,&column);
for(i=0;i<row;i++)
{
for(j=0;j<colunm;j++)
{
if((i==1)||(i==row)||(j==1)||(j==colunm))
{
printf(“*”);
}
else{
printf(” “);
}
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Size 5
Enter Colunm Size 5
*****
*      *
*      *
*      *
*****
Pattern-3
write a program to print pattern.
********
**  **  **
*  *    *  *
**  **  **
*  *    *  *
********
Explanation
1.सबसे पहले यूजर से row और column के number को input करा लेते है |
2.उसके बाद looping होती है जिसमे दो loops होते है|
3.outer loop मे , ‘i’ की value ‘1’ से initial होती | ये loop तब तक चलते है जब तक इसकी value ‘row’ से छोटी या सामान हो |
4.inner loop मे , j की value ‘1’ से initial होती है | ये loop तब तक चलता है जब तक इसकी value ‘column’ से छोटी या सामान हो |
इस loop की body मे , जब i=1 और i=row और j=1 और j=colunm और i=j और j=r-i+1  होती है तब “*” print होगा |
अन्यथा space ” ” print होगा |
Source Code
#include<stdio.h>
#include<conio.h>
void main()
{
int i , j ;
int row , column;
printf(“Enter Row Size”);
scanf(“%d”,&row);
printf(“Enter Colunm Size”);
scanf(“%d”,&column);
for(i=0;i<row;i++)
{
for(j=0;j<colunm;j++)
{
if((i==1)||(i==row)||(j==1)||(j==colunm)||(i==j)||(j==(r-i+1)))
{
printf(“*”);
}
else{
printf(” “);
}
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Size 5
Enter Colunm Size 5
*****
**  **
*  *  *
**  **
*****
Pattern-4
write a program to print square pattern.
     ******
   ******
 ******
******
******
Explanation
1.सबसे पहले यूजर से row और column के number को input करा लेते है |
2.उसके बाद looping होती है जिसमे तीन  loops होते है|
3.outer loop मे , ‘i’ की value ‘1’ से initial होती | ये loop तब तक चलते है जब तक इसकी value ‘row’ से छोटी या सामान हो |
4.inner loop 1  मे , j की value ‘1’ से initial होती है | ये loop तब तक चलता है जब तक इसकी value
‘row-i’ से छोटी या सामान हो |
इस loop की body मे , space ” ” को print करेगे |
5.inner loop 2  मे , j की value ‘1’ से initial होती है | ये loop तब तक चलता है जब तक इसकी value
‘colunm’ से छोटी या सामान हो |
इस loop की body मे , j की value को print करेगे |
Source Code
#include<stdio.h>
#include<conio.h>
void main()
{
int i , j ;
int row , column;
printf(“Enter Row Size”);
scanf(“%d”,&row);
printf(“Enter Colunm Size”);
scanf(“%d”,&column);
for(i=1;i<=row;i++)
{
for(j=1;j<row-i;j++)
{
printf(” “);
}
for(j=1;j<colunm;j++)
{
printf(“*”);
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Size 5
Enter Colunm Size 5
     ******
   ******
 ******
******
******
Pattern-3
write a program to print square pattern.
*****
*****
 *****
   *****
     *****
Explanation
1.सबसे पहले यूजर से row और column के number को input करा लेते है |
2.उसके बाद looping होती है जिसमे तीन  loops होते है|
3.outer loop मे , ‘i’ की value ‘1’ से initial होती | ये loop तब तक चलते है जब तक इसकी value ‘row’ से छोटी या सामान हो |
4.inner loop 1  मे , j की value ‘1’ से initial होती है | ये loop तब तक चलता है जब तक इसकी value
‘i’ से छोटी या सामान हो |
इस loop की body मे , space ” ” को print करेगे |
5.inner loop 2  मे , j की value ‘1’ से initial होती है | ये loop तब तक चलता है जब तक इसकी value
‘colunm’ से छोटी या सामान हो |
इस loop की body मे , j की value को print करेगे |
Source Code
#include<stdio.h>
#include<conio.h>
void main()
{
int i , j ;
int row , column;
printf(“Enter Row Size”);
scanf(“%d”,&row);
printf(“Enter Colunm Size”);
scanf(“%d”,&column);
for(i=1;i<=row;i++)
{
for(j=1;j<i;j++)
{
printf(” “);
}
for(j=1;j<=colunm;j++)
{
printf(“*”);
}
printf(“\n”);
}
getch();
}
आउटपुट होगा :
Enter Row Size 5
Enter Colunm Size 5
*****
*****
 *****
   *****
     *****
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