Pattern Printing | Problems on Loops - Part 1 | Lecture 7 | C++ and DSA Foundation Course

College Wallah
24 Oct 202242:29

Summary

TLDRThis video script discusses various programming concepts related to loops and patterns. It explains how to implement loops to create different types of patterns, such as rectangular and triangular patterns, using nested loops and conditional statements. The instructor guides viewers on how to approach pattern questions by focusing on the initialization and stopping points of loops, ensuring that the loops are comfortable and the pattern is clear. The script also touches on numeric patterns and the importance of testing the program with different inputs to ensure it works for all cases.

Takeaways

  • 😀 The video is a tutorial focused on teaching loops and patterns using programming concepts.
  • 🔍 The script discusses different types of loops and their implementation, aiming to make the viewer comfortable with using loops in programming.
  • 📚 The tutorial begins with a rectangular pattern example, explaining how to use loops to print a pattern of stars based on given input parameters like the number of rows and columns.
  • 💡 It emphasizes the importance of understanding the starting and stopping points of loops, which is crucial for solving pattern questions.
  • 🔢 The video provides a method to solve pattern questions by considering the number of rows, columns, and what needs to be printed in each iteration of the loop.
  • 📈 The script progresses to more complex patterns, such as inverted triangular patterns, where the number of columns decreases with each row.
  • 📝 The importance of testing the pattern with different inputs is highlighted to ensure the solution is not limited to a single scenario.
  • 📉 The tutorial touches on numeric rectangular patterns, explaining how to print numbers in ascending and descending order within a pattern.
  • 📌 The concept of alternating between 'true' and 'false' or 'van' and 'tuu' in a pattern is introduced, showing how to determine the correct sequence using the row and column numbers.
  • 👨‍🏫 The instructor encourages practice to improve understanding and comfort with loop concepts, as it will clarify the approach to solving pattern questions.

Q & A

  • What is the main topic discussed in the video script?

    -The main topic discussed in the video script is the concept of loops and patterns in programming, specifically focusing on rectangular and triangular patterns.

  • What is the purpose of discussing loops in the script?

    -The purpose of discussing loops in the script is to teach viewers how to implement different types of loops to create various patterns, making them comfortable with using loops in programming.

  • Can you explain the basic concept of a rectangular pattern as mentioned in the script?

    -A rectangular pattern, as discussed in the script, involves printing a series of characters (like stars) in a rectangular format based on given input parameters, such as the number of rows and columns.

  • How does the script describe the process of creating a pattern with loops?

    -The script describes the process by first identifying the input parameters for the pattern, such as the number of rows and columns, and then using nested loops to print the characters in the desired pattern.

  • What is a nested loop as per the script?

    -A nested loop, according to the script, is when one loop is placed inside another loop, allowing for more complex patterns to be created by repeating the inner loop for each iteration of the outer loop.

  • How does the script suggest solving pattern questions?

    -The script suggests solving pattern questions by understanding the starting point, stopping point, and the incrementation of the loops, ensuring that the pattern is solved for any given input, not just specific cases.

  • What is the significance of the input parameters in creating patterns as discussed in the script?

    -The input parameters are significant as they determine the dimensions and the specific details of the pattern, such as the number of rows and columns, which directly affect how the loops are structured and the final output.

  • How does the script handle variations in the pattern, such as printing spaces instead of stars?

    -The script handles variations by adjusting the conditions within the loops, such as using if-else statements to decide whether to print a star or a space based on the current row and column numbers.

  • Can you provide an example of a triangular pattern question discussed in the script?

    -An example of a triangular pattern question discussed in the script is to print a pattern where the number of stars increases by one in each row, starting from the top of the triangle and moving downwards.

  • What is the importance of testing pattern solutions with different inputs as emphasized in the script?

    -The importance of testing pattern solutions with different inputs, as emphasized in the script, is to ensure that the solution is not limited to specific cases but is universally applicable to any valid input, demonstrating a clear understanding of loops and patterns.

  • How does the script guide viewers to approach complex pattern questions?

    -The script guides viewers to approach complex pattern questions by breaking down the problem into smaller parts, identifying the pattern in rows and columns, and incrementally building the solution while considering all possible variations in the pattern.

Outlines

00:00

📚 Introduction to Loops and Pattern Printing

The script begins with a greeting and an introduction to the concept of loops in programming, specifically in the context of pattern printing. The lecturer discusses various types of loops and their implementation, aiming to make the audience comfortable with using loops for pattern printing. The first pattern example given is a rectangular pattern, where the number of rows and columns are based on user input. The explanation includes how to use nested loops to print a line of stars and then repeat that line the required number of times to form the rectangle.

05:04

🔍 Understanding Loops and Pattern Dependencies

This paragraph delves deeper into understanding how loops are dependent on user input for pattern printing. It emphasizes the importance of knowing the starting and stopping points of loops, which is crucial for solving any pattern-related questions. The script uses the example of a rectangular pattern, explaining how the number of rows and columns dictate the loop's behavior. It also touches on how to code these loops, taking inputs for the number of rows and columns from the user, and then using nested loops to print stars and spaces to form the desired pattern.

10:06

📈 Advanced Pattern Printing with Conditions

The script introduces a more complex pattern printing scenario where conditions are used to determine whether to print stars or spaces. It explains the importance of tracking the current row and column numbers to decide the printing action. The example provided involves printing stars only on certain rows and columns, creating an angular pattern. The explanation guides through the logic of using if-else conditions within loops to achieve the desired pattern output.

15:08

💡 Conditional Printing in Patterns

This paragraph continues the discussion on conditional printing within patterns, focusing on when and where to print stars or spaces. It provides insights into how to determine the positions for stars and spaces within a pattern, using the row and column numbers as a reference. The script also mentions the importance of considering the boundaries of the pattern to ensure the correct output.

20:08

🌟 Numerical Patterns and Loops

The focus shifts to numerical patterns, where the script explains how to print numbers in a specific order within a pattern. It discusses the concept of incrementing and decrementing order, and how to divide the pattern into parts to print spaces and numbers accordingly. The example given illustrates how to print numbers in an ascending order up to a certain point and then in a descending order, using loops and conditional statements.

25:10

🔢 Complex Numerical Patterns with Alternating Values

This paragraph presents a trickier numerical pattern that involves alternating between printing 'true' or 'false', or numerical values. It explains the concept of using the row and column numbers to determine the pattern's structure and when to print certain values. The script provides an example of a pattern that requires printing numbers in a specific sequence, depending on the position within the pattern.

30:32

🔄 Understanding Alternating Print Concepts

The script discusses the concept of alternating prints, where the order of printing changes between rows. It explains how to determine the points at which to switch between printing 'true' and 'false', or different numerical values. The explanation includes the logic behind using the row number to decide the printing action, and how to implement this in code using loops and conditional statements.

35:33

📐 Printing Numerical Patterns in Decreasing Order

This paragraph focuses on printing numerical patterns in a decreasing order, starting from a certain number and counting down. It explains how to use loops to print numbers up to a specified limit and then reverse the count for the next set of numbers. The example provided demonstrates how to print numbers in a pattern that requires alternating between ascending and descending numerical sequences.

40:34

🎓 Conclusion and Encouragement to Practice

The script concludes with an encouragement to practice loop concepts and pattern printing to gain clarity and mastery. It suggests that the more one practices, the better they will understand loops and be able to solve pattern-related questions. The lecturer also hints at continuing the discussion on loops and patterns in the next video, thanking the audience for watching and bidding them farewell.

Mindmap

Keywords

💡Loops

Loops are a fundamental concept in programming that allow for the execution of a block of code repeatedly. In the context of this video, loops are used to print patterns such as stars and numbers in a structured format. The script discusses different types of loops and their implementation, emphasizing their importance in solving pattern-related problems.

💡Pattern Questions

Pattern questions refer to problems in programming that involve creating specific visual patterns using loops and conditional statements. The script mentions pattern questions as a way to engage with the audience and to demonstrate the application of loops. Examples from the script include rectangular and triangular patterns that are created using loops.

💡Rectangular Pattern

A rectangular pattern is a specific type of pattern that resembles a rectangle when printed. The script describes how to create a rectangular pattern using loops, where the number of rows and columns are determined by user input. The pattern is achieved by nested loops, one for the rows and another for the columns.

💡Nested Loops

Nested loops occur when a loop is placed inside another loop. This concept is crucial for creating more complex patterns, as it allows for the iteration over multiple dimensions. In the script, nested loops are used to print a rectangular pattern, where the outer loop handles the rows and the inner loop handles the columns.

💡Input

Input in programming refers to the data provided by the user that the program uses for processing. The script mentions taking input from the user to determine the dimensions of the patterns, such as the number of rows and columns, which are essential for the loops to function correctly.

💡Stars

In the context of this video, stars are used as a visual element in the patterns being printed. The script discusses printing lines of stars to create shapes and designs. For example, the rectangular pattern involves printing lines of stars based on the number of columns specified by the user.

💡Conditional Statements

Conditional statements are used in programming to perform different actions based on certain conditions. Although not explicitly detailed in the script, they are implied as a method to control the flow of the program, especially when deciding when to print stars or spaces in patterns.

💡Incrementing

Incrementing is the process of increasing a variable's value by a certain amount, typically by one. The script refers to incrementing in the context of loops, where variables like the row number or column number are increased to control the pattern's progression.

💡Numerical Pattern

A numerical pattern involves printing numbers in a specific sequence or shape. The script introduces a pattern where numbers are printed in ascending order, starting from one, and then in descending order, demonstrating the use of loops for both sequences.

💡Programming Concepts

Programming concepts encompass the fundamental ideas and techniques used in programming, such as loops, conditionals, and variables. The script uses these concepts to explain how to solve pattern questions, emphasizing the importance of understanding these basics for more complex programming tasks.

💡Practice

Practice is highlighted in the script as a key aspect of mastering programming skills, especially when it comes to pattern questions. The video encourages the audience to practice pattern problems to become more comfortable with the concepts of loops and to improve their programming abilities.

Highlights

Introduction to a new concept in the video by Anadar Video by Skill Llast, exploring different types of loops and their implementation.

Engaging with loops and pattern questions to make the audience comfortable with using loops and solving pattern questions.

Explanation of rectangular patterns and how to input rows and columns to print a pattern.

Demonstration of using nested loops to print a rectangular pattern with stars.

Technique to solve pattern questions by focusing on the initialization point, stopping point, and what needs to be printed within the loops.

How to determine the number of rows and columns based on user input and their dependency on the pattern to be printed.

Approach to printing patterns that involve both stars and spaces, with conditions for when to print each.

Solving numerical rectangular patterns by printing numbers in ascending and descending order within a pattern.

The importance of testing pattern solutions with various inputs to ensure the solution is not limited to a single case.

Method to print inverted triangular patterns by understanding the dependency on the number of rows and how columns change with each row.

Explanation of how to print spaces before stars in a pattern to create a specific design.

Concept of dividing columns into parts to print spaces and numbers alternatively in a pattern.

Strategy for printing numeric values in a pattern by starting from a specific number and incrementing or decrementing based on the row number.

The use of loops to print numbers in a pattern, emphasizing the importance of understanding the counting start point and the range.

How to handle printing alternate values such as 'true' and 'false' or 'van' and 'tuu' in a pattern based on row and column positions.

Final thoughts on practicing loop concepts to gain clarity and confidence in solving pattern questions.

Transcripts

play00:00

हेलो हेलो एवरीवन दिस इस उर्मी एंड वेलकम

play00:03

तू अनादर वीडियो बाय प स्किल्स लास्ट

play00:07

लेक्चर में हमने एक नया कॉन्सेप्ट पढ़ा था

play00:09

जो की हेल्प हमने डिफरेंट टाइप्स ऑफ लूप्स

play00:13

भी देखे द और उनकी इंप्लीमेंटेशन भी देखी

play00:15

थी कोर्ट में आज की वीडियो में हम लूप्स

play00:18

के ऊपर और क्वेश्चंस कर रहे होंगे एंड नॉट

play00:21

जस्ट अन्य क्वेश्चंस विल बी डूइंग पैटर्न

play00:24

क्वेश्चंस इन डेज़ लेक्चर पैटर्न

play00:26

क्वेश्चंस जो है वो बहुत इंटरेस्टिंग टाइप

play00:28

ऑफ क्वेश्चंस होते हैं एंड ये मोस्टली आप

play00:30

इसलिए करते हो ताकि आप को लूप्स के साथ आप

play00:33

कंफर्टेबल हो पाए एंड पैटर्न क्वेश्चंस

play00:36

ऐसे हैं की आप जितना कर लो उतना आपको कम

play00:39

लगेगा बहुत सारे पैटर्न क्वेश्चंस होते

play00:41

हैं एंड यू कैन यू विल बी एबल तू तू ऑल ऑफ

play00:44

डेम आफ्टर 2 डेज़ लेक्चर ठीक है तो

play00:46

स्टार्ट करते हैं सबसे पहला हमारा बेसिक

play00:49

जो पैटर्न क्वेश्चन है वो ये है

play00:52

रैक्टेंगुलर पैटर्न अब किसी भी पैटर्न

play00:56

क्वेश्चन में तुम्हें कुछ इनपुट दे रखा

play00:58

होगा एन समथिंग

play01:00

उसके हिसाब से आपको एक पैटर्न प्रिंट करना

play01:03

होगा ठीक है तो इस क्वेश्चन में हमें

play01:06

इनपुट दे रखा होगा जो रोज है नंबर ऑफ रोज

play01:10

और जो नंबर ऑफ कॉलम्स होने चाहिए

play01:12

रेक्टेंगल की वो ठीक है तो यहां पे मेरी

play01:15

नंबर ऑफ रोज जो है वो थ्री है और नंबर ऑफ

play01:18

कॉलम्स जो है वो 6 है तो मेरे को थ्री और

play01:21

सिक्स जो है वो इनपुट देयर रखा होगा और

play01:24

उसके हिसाब से मुझे ये पैटर्न जो है वो

play01:26

प्रिंट करना है ठीक है अब इस पैटर्न को

play01:29

प्रिंट करने के लिए क्या करना होगा सबसे

play01:32

पहले पूरे रेक्टेंगल को छोड़ दो ठीक है

play01:35

सबसे पहले ये जो फर्स्ट ये जो लाइन है ऑफ

play01:39

स्टार्स सिर्फ इसको देखो अगर मुझे सिर्फ

play01:41

ये एक लाइन जो है ये प्रिंट करनी है ठीक

play01:45

है तो इसको मैं कैसे कर सकती हूं इसके लिए

play01:47

मैं एक फॉर लूप लगा सकती हूं 6 बारी

play01:50

प्रिंट स्टेटमेंट लिखने की जगह आई कैन

play01:52

जस्ट रानो लू ठीक है डेट विल रन सिक्स

play01:56

टाइम्स तो मैं क्या कर रही हूं की मैंने

play01:58

एक लूप लगाया है ठीक है जिसमें मैंने लिख

play02:02

दिया की के इस इक्वल तू 12

play02:06

इक्वल तू सिक्स जो है ये चलेगा एंड के

play02:10

प्लस प्लस और इस लूप के अंदर मैं क्या कर

play02:13

रही होंगी प्रिंट कर रही होंगी स्टार

play02:18

ठीक है तो इस लूप से मेरे पास एक लाइन ए

play02:22

जाएगी ऑफ सिक्स स्टार्स अब मुझे ये जो एक

play02:26

लाइन है ऑफ सिक्स स्टार्स ये तीन बारी

play02:28

प्रिंट करनी है तो मेरा जो ये पूरा

play02:30

रैक्टेंगुलर पैटर्न है ये फॉर्म हो जाएगा

play02:33

अब इसके लिए मैं क्या करूंगी इसके लिए मैं

play02:36

उसे करूंगी नेस्टेड लूप्स का nisted लूप्स

play02:40

क्या होते हैं जब मैं एक लूप के अंदर

play02:42

दूसरा लूप उसे करती हूं तो उसको नेस्टेड

play02:45

लूप्स कहते हैं ठीक है मुझे क्या करना है

play02:48

मैंने एक लाइन लिख दी है स्टार्स की फॉर

play02:51

लूप लगाकर अब मुझे ये लाइन जो है ये तीन

play02:55

बार ये प्रिंट करनी है तो मैं इस लूप को

play02:59

आई हैव तू रन थ्री टाइम्स अब मैं इस लूप

play03:02

को थ्री टाइम्स जो है कोड में लिख सकते हो

play03:05

या फिर मैं इसके बाहर एक और लूप लगा सकती

play03:08

हूं जो की इस इनर लूप को तीन टाइम

play03:18

जो की चलेगा वैन से लेकर लेस दें इक्वल तू

play03:22

थ्री तक आई प्लस प्लस

play03:31

है जो कोड

play03:33

हो जाएगा एंड जब भी मेरा जो अंदर वाला लूप

play03:37

है वो फिनिश होगा उससे बाहर आते ही मैं

play03:40

नेक्स्ट लाइन प्रिंट कर दूंगी ठीक है

play03:43

जिससे की वो नेक्स्ट लाइन में नेक्स्ट जो

play03:46

लाइन ऑफ स्टार्स है वो प्रिंट हो ठीक है

play03:48

तो इस कोर्ट से मेरे पास ये रैक्टेंगुलर

play03:51

पैटर्न ए जाना चाहिए राइट

play03:55

[संगीत]

play03:57

एंगुलर पैटर्न था आगे बढ़ते हुए अगर आपको

play04:01

कोई भी पैटर्न क्वेश्चंस सॉल्व करना है तो

play04:04

मैं उसकी तकनीक आपको एक बता रही हूं यह

play04:07

हमेशा ध्यान रखना है इससे आपके सारे

play04:09

पैटर्न के क्वेश्चंस जो है चाहे कितना भी

play04:12

डिफिकल्ट हो वह सॉल्व हो जाएगा ठीक है तो

play04:15

आपको क्या करना है किसी भी पैटर्न वाले

play04:18

मैं आपको समझ में ए गया की हम पैटर्न की

play04:20

क्वेश्चंस में लूप्स उसे कर रहे होंगे ठीक

play04:23

है लूप्स में हमें क्या देखना होता है

play04:26

लूप्स में हमें ये देखना होता है की वो

play04:27

कहां से कहां तक चलेगा ठीक है उसका

play04:31

इनीशिएलाइजेशन पॉइंट क्या है उसको

play04:33

स्टॉपिंग पॉइंट क्या है राइट तो किसी भी

play04:37

पैटर्न वाले क्वेश्चन में आपको तीन चीज

play04:40

देखनी है सबसे पहले जो हमारी रोज है

play04:43

पैटर्न की यहां पे थ्री रोज है ये हमारे

play04:47

इनपुट पे कैसे डिपेंड कर रही है मैं हमें

play04:49

कुछ इनपुट दे रखा होगा यहां पे हमें नंबर

play04:53

ऑफ रोज नंबर ऑफ कोल्लम से आप समझ लो एन और

play04:56

एम जो है ये इनपुट दे रखा है यहां पे एन =

play05:00

3 है और एम = 6 है

play05:04

अब हमारा रोज जो है नंबर ऑफ रोज जो पैटर्न

play05:08

है ये हमारा इनपुट पर कैसे डिपेंड कर रहा

play05:11

है हमारा नंबर ऑफ कॉलम्स जो है वह हमारे

play05:15

इनपुट पर कैसे डिपेंड कर रहा है और जो में

play05:19

प्रिंट करना है वह क्या

play05:23

लग रही है तो हम किसी भी पार्टनर क्वेश्चन

play05:26

को सॉल्व कर सकते हैं

play05:30

यहां पर हमारा जो नंबर ऑफ रोज है वो कैसे

play05:35

हमारे इनपुट पर डिपेंड कर कहां से कहां तक

play05:37

हमें लूप लगाना पड़ेगा

play05:39

हमें पता है की अपने रोज को प्रिंट करने

play05:42

के लिए हमें वैन तू एंड तक अपने लूट को

play05:45

चलाना पड़ेगा सिमिलरली हमारे नंबर ऑफ

play05:48

कॉलम्स जो है ये जो कॉलम्स है यह प्रिंट

play05:52

करने के लिए हमें 1 2 एम अपने लूप को

play05:55

चलाना पड़ेगा राइट जैसे हमने देखा था अभी

play05:58

कोर्ट में हम 1 2 3 चला रहे द अपना रोज को

play06:00

प्रिंट करने के लिए और वैन तू सिक्स चला

play06:02

रहे द अपना कॉलम स्प्रिंग करने के लिए ठीक

play06:05

है तो मैं वही उसको एन और एम के टर्म्स

play06:08

में लिख रही हूं

play06:10

तुम्हारा रोज आएगा कॉलम वाले रूप वैन तू

play06:15

एम जाएगा और जो हमें प्रिंट करना है हमें

play06:18

प्रिंट क्या करना है हमें स्टार प्रिंट

play06:20

करना है ठीक है तो इस क्वेश्चन को एक बार

play06:24

कोड में भी देख लेते हैं और तो हमने इसको

play06:26

को दिस कर लिख के देख लिया है बट यहां पे

play06:30

आईडी में भी देख लेते हैं सबसे पहले हम ले

play06:33

लेते हैं एन और एम जो की हम यूजर से कुछ

play06:37

इनपुट ले रहे होंगे

play06:40

ठीक है अब यूजर से इनपुट लेने के बाद हम

play06:44

लूप लगा देंगे दो सबसे पहले तो आई जो की

play06:47

चलेगा वैन से लेके एन तक और इसके अंदर

play06:51

हमारा ए जाएगा के वाला रूम जो की कॉलम्स

play06:57

करेगा

play06:58

वैन से लेकर जेल लेस दें इक्वल तू एम तक

play07:04

इसके अंदर हम प्रिंट क्या कर रहे होंगे

play07:06

हमें पता है हमें स्टार प्रिंट करना है

play07:09

ठीक है जैसी हमारा कॉलम वाला लूप जो है वह

play07:13

खत्म होगा तो हम नेक्स्ट लाइन प्रिंट कर

play07:15

देंगे इसको रन करते हैं कोर्ट को

play07:27

यहां पर मैं इनपुट दे रही हूं थ्री एंड

play07:30

सिक्स एंड ये हमारा पैटर्न बन रहा है कोई

play07:33

और भी इनपुट दे कर देख सकते हैं फाइव एंड

play07:36

सेवन तो यह हमारा जो है पैटर्न बन रहा है

play07:40

ठीक है तो इस तरह से हमने रैक्टेंगुलर

play07:44

पैटर्न देखा है अब धीरे-धीरे करके हम

play07:47

डिफिकल्टी जो है वो पेटर्न्स की बढ़ते

play07:50

रहेंगे एंड देखेंगे की उनको कैसे सॉल्व कर

play07:53

सकते हैं नेक्स्ट जो क्वेश्चन है वह है

play07:57

यहां पर आप देख रहे हो अंदर जो है यहां पर

play08:01

बीच में हमें स्पेस प्रिंट करना पड़ेगा इस

play08:05

पैटर्न को प्रिंट करने के लिए है ना

play08:08

यहां पर हमें कुछ स्पेस प्रिंट करना है अब

play08:13

यह जो क्वेश्चन है यहां पर हमें इनपुट दे

play08:16

रखा होगा ठीक है यहां पर अगेन हमारा

play08:19

हमें रैक्टेंगुलर क्योंकि तो हमें एन और

play08:23

एम कुछ इनपुट दे रखा होगा एंड और एम

play08:26

इस केस में हमारा

play08:29

जो सेट है वो सिक्स है ठीक है बट हमें

play08:33

जनरलाइज्ड केस के लिए पैटर्न ढूंढना है

play08:35

ठीक है तो यहां पे जैसे की मैंने बोला की

play08:39

हमें तीन चीज देखनी है हमारी रोज कॉलम्स

play08:42

और प्रिंट क्या करना है रोज जो है मैं ये

play08:45

देख रही हूं की फोर रोज है ठीक है जो की

play08:48

मैं बोल सकती हूं वो प्रिंट करने के लिए

play08:50

मेड को वैन तू एन अपना लूप जो है चलाना

play08:55

पड़ेगा तो उसे प्रिंट करने के लिए

play08:57

सिमिलरली कॉलम्स जो है

play09:00

वह मेरा 126 तक जाएगा

play09:03

12 एम जो मेरे को इनपुट दे रखा होगा उसे

play09:07

तक मैं अपना लूप chalaungi अब क्वेश्चन

play09:09

आता है प्रिंट क्या करना है पिछले वाले

play09:11

क्वेश्चन में हम हर जगह प्रिंट कर रहे द

play09:13

स्टार यहां पे हर जगह स्टार प्रिंट नहीं

play09:16

हो रहा है यहां पे कुछ जगह स्टार प्रिंट

play09:19

हो रहा है कुछ जगह स्पेस प्रिंट हो रहा है

play09:22

है ना स्पेस प्रिंट होगा तभी ये होलो

play09:25

रेक्टेंगल जो है ये बन पाएगा अब बात ये

play09:28

आती है की कहां पे हमें स्टार प्रिंट करना

play09:31

है और कहां पे स्पेस प्रिंट करना है तो वह

play09:35

देखने के लिए आप ये देखिए आपको पैटर्न जो

play09:38

है यहां पे कुछ पैटर्न देखना पड़ेगा की

play09:40

किस हिसाब से कहां पे हम स्टार कर सकते

play09:44

हैं प्रिंट और कहां पर हम स्पेस प्रिंट कर

play09:47

सकते हैं

play09:54

तो हमें पता है की इस टाइम पर हम किस रोड

play10:00

नंबर पर और किस कॉलम नंबर पर है तो उसके

play10:02

हिसाब से हमें डिसाइड करना है की कहां पर

play10:06

स्पेस प्रिंट करना है और कहां पे स्टार्ट

play10:08

ठीक है तो अगर आप यहां पर नोटिस करोगे यह

play10:12

जो है यह जो है यह हमारा आई = 1 है या फिर

play10:18

मैं बोलूं

play10:20

इस इक्वल तू वैन है ठीक है यहां पे मेरा

play10:25

रो = एन है

play10:28

सिमिलरली आते दिस पॉइंट मेरा कॉलम जो है

play10:31

इस इक्वल तू वैन है एंड इधर जो है मेरा

play10:35

कॉलम इस इक्वल तू एम है राइट तो अब आप

play10:39

लोगों को यह दिख रहा है की जब भी मेरा रो

play10:41

जो है वो फर्स्ट कॉल फर्स्ट रो है या फिर

play10:44

मेरा रोज जो है वो लास्ट रो है या फिर

play10:48

मेरा कॉलम फर्स्ट कॉलम है या फिर कॉलम

play10:50

लास्ट कॉलम है वहां पे मैं सिर्फ बाउंड्री

play10:54

पे अपना स्टार प्रिंट कर रही हूं ठीक है

play11:12

और कॉलम इक्वल तू इक्वल तू वैन

play11:16

इक्वल तू इक्वल तू एम इन सब केसेस में

play11:20

हमें प्रिंट करना है स्टार एंड बाकी सारे

play11:25

केसेस में हम प्रिंट कर रहे होंगे स्पेस

play11:31

ठीक है

play11:36

तो इसको एक बार करके देखते हैं की ये

play11:39

प्रिंट होता है हमारा रेक्टेंगल या नहीं

play11:41

अगेन यहां पे हम एन और एम जो है वो यूजर

play11:46

से इनपुट ले लेंगे

play11:49

एंड हम एक लूप लगाएंगे सबसे पहले रोज

play11:52

क्विट करने के लिए जो की चलेगा वैन से

play11:55

लेके एन तक एंड इसके अंदर हम लूप लगा

play11:58

लेंगे के जो की कॉलम स्क्वायर ट्रेड करेगा

play12:01

जी इस इक्वल तू वैन से लेकर एम तक

play12:07

इसके अंदर नौ अगेन सी कैन चेक अगर हमारा

play12:11

आई इक्वल तू वैन है और के इक्वल तू वैन है

play12:16

और आई = एन और के इक्वल तू एम

play12:24

इन ऑल डी केसेस विल बी प्रिंटिंग स्टार

play12:29

वर्ण बीपी प्रिंटिंग स्पेस

play12:40

हम बाहर ए जाएंगे तो हम नेक्स्ट लाइन

play12:43

प्रिंट कर देंगे ठीक है

play12:53

यहां पर

play13:09

तुम्हारा होलो रेक्टेंगल जो है यह प्रिंट

play13:11

हो गया है वीकेंड

play13:15

जैसे की 5 एंड 10 तो दिस इस रोरो

play13:20

रेक्टेंगल ठीक है तो बढ़ते हैं नेक्स्ट

play13:23

क्वेश्चन पे

play13:25

नेक्स्ट अब हम आते हैं ट्रायंगुलर

play13:30

पेटर्न्स पर आपको एक इनपुट देयर तुंगा

play13:34

जैसे आपको दो इनपुट्स मिल रहे द एनोर्म

play13:36

यहां पे आपको एक इनपुट दे रखा होगा एन और

play13:40

यहां पर हमारा एन = क्या है फोर है ठीक है

play13:43

एन = 4 के लिए हमारा ये ट्रायंगुलर पैटर्न

play13:47

जो है हमें प्रिंट करना है

play13:50

अब इसको ऐसे देखो सबसे पहले रोज देखते हैं

play13:54

की रोज जो है हमारे इनपुट पर कैसे डिपेंड

play13:57

कर रहा है रोज हमने देख लिया इस पैटर्न

play14:00

में फोर है और

play14:02

दिस पैटर्न

play14:05

बोल सकती हूं की रोज के लिए मेरे को ब्लू

play14:07

लगाना पड़ेगा फ्रॉम वैन तू एंड कॉलम्स

play14:15

फॉर कॉलम्स अब देखोगे हर रो में डेट

play14:19

डिफरेंट नंबर ऑफ कॉलम्स ठीक है फर्स्ट

play14:22

रोमांस

play14:34

मेरे जो यहां पर नंबर ऑफ कॉलम्स है वह भी

play14:37

इतने ही है यहां पर वैन कॉलम है यहां पर

play14:39

तू कॉलम है यहां पर थ्री कॉलम्स है एंड

play14:43

यहां पे फोर कॉलम्स है तो मेरे कॉल

play14:48

तू रो नंबर है

play14:54

ठीक है जहां पर मेरा रोल नंबर वैन है वहां

play14:56

पे मैं वैन कॉलम प्रिंट कर रही हूं जहां

play14:58

पे रोल नंबर तू है वहां पे तू कॉलम

play15:01

स्प्रेड करो सो ऑन एंड मेरको प्रिंट क्या

play15:04

करना है मुझे प्रिंट करना है स्टार राइट

play15:07

तो इसको भी जल्दी से प्रिंट करके देखते

play15:10

हैं हमें यहां पर

play15:13

मिल रहा होगा सिर्फ एक इनपुट मिल रहा होगा

play15:16

हमारा लूप जो है सबसे पहले रोज के लिए

play15:19

चलेगा वैन से लेकर एंड तक एंड इसके अंदर

play15:23

हमारा लूप कॉलम्स के लिए चलेगा जो की हमने

play15:26

देख लिया है वैन से लेकर

play15:28

2 आई तक

play15:31

यहां पर हम प्रिंट कर रहे होंगे स्टार

play15:42

तो इसको देखते हैं

play15:47

यहां पर मैंने पैटर्न प्रिंट कर लिया

play15:59

था उसी का इन वोटेड पैटर्न है यहां पे

play16:03

हमारा फर्स्ट जो रोल नंबर है वहां पर

play16:08

हमारे पास फोर कॉलम्स है ठीक है जब हमारा

play16:11

रो

play16:14

जब हमारा रो इस इक्वल तो वैन है तो हमारा

play16:18

कॉलम्स जो है

play16:20

यहां पर रो नंबर तू है तो मैंने कॉलम्स जो

play16:23

है वह 3 है ठीक है तो यहां पर आप बोल सकते

play16:27

हो की हमारे कॉलम्स जो है वो वैन तू आई

play16:31

जैसे लास्ट टाइम जा रहे द हमारे पिछले

play16:35

वाले क्वेश्चन में यहां पे हमारे जा रहे

play16:38

हैं 1 2 एंड - रो नंबर

play16:43

+1 तक ठीक है तो एंड जो हमारा यहां पे अगर

play16:48

फोर है तो फोर माइंस वैन प्लस वैन तो यहां

play16:52

पर फोर ए गए

play16:56

सिमिलरली 4 - 22 + 13 कॉलम्स ए गए एंड सो

play17:01

ऑन ठीक है तो इस वाले क्वेश्चन को आप लोग

play17:04

खुद प्रिंट करके देखना की कैसे जो है आप

play17:08

इनवर्टेड ट्रायंगुलर पैकिंग प्रिंट कर

play17:10

सकते हैं ठीक है दिस इस बात इस सिमिलर तू

play17:12

डी लास्ट वैन

play17:13

बढ़ते हैं अब थोड़ा सा डिफिकल्ट क्वेश्चन

play17:15

की तरफ यहां पे अब इस क्वेश्चन को मैं

play17:18

डिफिकल्ट इसलिए बोल रही हूं क्योंकि ये जो

play17:20

है हमारा

play17:22

लाइट या लेफ्ट या लाइन नहीं है ठीक है

play17:25

यहां पे हमारे पैटर्न में इसको प्रिंट

play17:29

करने के लिए सबसे पहले हमें यहां पे कुछ

play17:30

स्पेस प्रिंट करने पड़ेंगे ठीक है एंड दें

play17:34

हमारे स्टार्स ए रहे होंगे ठीक है तो ये

play17:37

थोड़ा सा ट्रिक है एंड यहां पर क्योंकि

play17:40

ट्रायंगुलर पैटर्न है तो हमें एक इनपुट

play17:42

देयर रखा होगा यहां पे ये जो पैटर्न है

play17:45

दिस इस फॉर इनपुट एंड इसे इक्वल तू फोर

play17:49

देखते हैं अब इसके लिए कैसे प्रिंट हो रहा

play17:51

होगा

play17:55

एन पर कैसे डिपेंडेंट है हमारे रोज जो है

play17:59

वह फोर है और एन = 4 है तो रोज प्रिंट

play18:02

करने के लिए मेरे को 12 इंच जो है अपना

play18:04

लूप चलाना पड़ेगा

play18:12

की

play18:13

कॉलम्स एक तो डिफरेंट नंबर ऑफ कॉलम्स है

play18:17

इन एवरी रो एंड कॉलम्स में हमें कुछ

play18:22

कॉलम्स के लिए पहले स्पेस प्रिंट करना है

play18:24

एंड दें फॉर सैम कॉलम्स सी हैव तू प्रिंट

play18:28

स्टार्स तो हम यहां पर क्या कर सकते हैं

play18:31

कॉलम्स को दो पार्ट्स में डिवाइड कर दिया

play18:33

ठीक है सबसे पहले हम स्पेस प्रिंट करेंगे

play18:36

एंड दें हम स्टार प्रिंट करेंगे

play18:40

ठीक है मैं यह अंडरस्कोर यहां पर इसको

play18:43

नहीं लिखती हूं वर्ण कन्फ्यूजन होगा

play18:45

हम स्पेस प्रिंट करेंगे

play18:54

कहां से कहां तक हमें लूप चलाना पड़ेगा

play18:57

फॉर प्रिंटिंग स्पेस ठीक है स्पेस देखो

play19:02

यहां पे नोटिस करो

play19:05

स्पेस जो है यहां पर फर्स्ट यह मैं यहां

play19:10

पर रो नंबर लिख रही हूं

play19:13

फर्स्ट रो में हम थ्री स्पीशीज प्रिंट कर

play19:16

रहे हैं दें तू दें वैन एंड दें जीरो ठीक

play19:19

है तो ये आपको दिख रहा है जैसे हमारी रो

play19:22

नंबर बढ़ रहा है हमारे स्पेस जो है वो कम

play19:24

हो रहे हैं ठीक है सो दिस एंड वॉच रिलेशन

play19:26

तो इसको हम कैसे लिख सकते हैं यहां पर हम

play19:30

इसको ऐसे लिख सकते हैं एन - रो नंबर

play19:35

एंड हमारा फोर है

play19:38

-13 है ना तो यहां पे एन जो है फोर है एंड

play19:44

रो नंबर तू है तो यहां पे तू स्पेस तो मैं

play19:47

बोल सकती हूं की मुझे जो स्पेस प्रिंट

play19:49

करने हैं वो 1 2

play19:53

एन - रोल नंबर तक प्रिंट करने

play20:00

हैं वह

play20:04

अच्छे से लिख देती हूं

play20:08

12

play20:21

स्टार्स कितने प्रिंट करने हैं

play20:25

स्टार्स अगर आप नोटिस करोगे

play20:28

तो यहां पर फर्स्ट रो में हमारे स्टार वैन

play20:32

है दें थ्री है दें फाइव है एंड दें सेवन

play20:35

है अब दोबारा ये जो नंबर ऑफ स्टार्स है

play20:38

इसको एन से और आई से रिलेट करने की कोशिश

play20:42

करो एन से या फिर आय से ठीक है

play20:45

अब यहां पर जैसे मेरा आई जो है वो बढ़ रहा

play20:49

है वैसे मेरे नंबर ऑफ स्टार्स बढ़ रहे हैं

play20:51

तो मुझे ये पता चल गया की आई पे मैं इसको

play20:54

डिपेंड्स ऑन आई एंड मैं ऐसे लिख सकती हूं

play20:58

यार की 7

play21:00

7 =

play21:02

2 * 4 - 1

play21:07

सिमिलरली मैं फाइव को लिख सकता हूं 2 * 3

play21:10

- 1

play21:12

3 = 2 * 2 - 1 एंड 1 = 2 1 - 1 राइट तो

play21:20

यहां पर जो फोर थ्री तू वैन है ये मेरा

play21:22

क्या है ये मेरा रो नंबर है

play21:27

ये मेरा रो नंबर है ठीक है तो मैं यहां पे

play21:31

लिख सकती हूं की जो मेरे नंबर ऑफ स्टार्स

play21:34

है डेट इस

play21:35

1 2

play21:38

तू आई माइंस वैन ठीक है तो हमने देखी है

play21:45

स्टार्स हमें कहां से कहां तक प्रिंट करने

play21:48

और यह जो है हम दो लूप्स जो है स्पेस और

play21:51

सास प्रिंट करने के लिए इसके बाहर एक और

play21:54

लूप होगा जो इस चीज को फोर टाइम्स कर रहा

play21:57

होगा ठीक है तो इसको एक बार ये कोड में

play22:00

देखते हैं तो इस क्वेश्चन में हमें एक एन

play22:03

जो है हम इनपुट ले रहे होंगे एंड लूप

play22:07

लगाएंगे सबसे पहले रोज प्रिंट करने के लिए

play22:09

जो की चढ़ेगा वैन से लेकर

play22:13

इक्वल तू एन तक एंड

play22:17

इसके अंदर अब हमें दो लूप

play22:24

प्रिंट करना है हमें 1 से लेकर 10 इक्वल

play22:28

तू एन माइंस रो नंबर ठीक है तो एन - मिरर

play22:33

रो नंबर क्या है आई है यहां पे राइट एंड

play22:37

जी प्लस प्लस इतने मुझे स्पेस प्रिंट करने

play22:41

हैं

play22:43

इसके बाद में स्टार के लिए लगा सकती हूं

play22:47

यह जो है हमारा लुक चल रहा होगा वैन से

play22:50

लेकर 10 तक

play22:55

[संगीत]

play23:00

यहां पर मुझे प्रिंट क्या करना है स्टार

play23:03

प्रिंट करना है

play23:06

प्रिंट कर दूंगी नेक्स्ट लाइन

play23:10

ठीक है तो इसको रन करते हैं

play23:30

यहां पर मैनपुरी दे देती हूं फोन एंड राइट

play23:49

के लिए भी टेस्ट कर सकते हैं

play23:52

तो पैटर्न क्वेश्चंस में हमेशा सिर्फ एक

play23:55

इनपुट के लिए अपने प्रोग्राम को रन करके

play23:58

मत देखना क्योंकि हो सकता है की वह सिर्फ

play24:00

उसी इनपुट के लिए तुमने अपना प्रोग्राम जो

play24:04

है वो लिख लिया और वो बस उसी इनपुट के लिए

play24:06

तुम्हारा पैटर्न ए रहा है ऐसा नहीं होना

play24:07

चाहिए पैटर्न जो है वो कुछ भी इनपुट हो

play24:11

सारे इनपुट्स के लिए हम एक पैटर्न मिलना

play24:14

चाहिए उसकी शॉप जो है जो पैटर्न चाहता है

play24:17

वो से होना चाहिए ठीक है चाहे इनपुट कुछ

play24:21

भी हो अब बढ़ते हैं नेक्स्ट क्वेश्चन जो

play24:24

की न्यूमेरिकल रैक्टेंगुलर पैटर्न ये

play24:26

एक्चुअली स्क्वायर है यहां पे पैटर्न एंड

play24:28

ये जो हमें दे रखा है एन = 7 के लिए

play24:31

पैटर्न दे रखा है यहां पे अब आप ये देखना

play24:34

अब हम स्टार्स नहीं प्रिंट कर रहे हैं अब

play24:36

हम प्रिंट कर रहे हैं कुछ न्यूमेरिकल

play24:39

वैल्यू ठीक है तो अब हमें इस चीज पे भी

play24:41

फोकस करना पड़ेगा की कहां पे क्या हम

play24:43

वैल्यू जो है वो प्रिंट कर रहे हैं

play24:46

इस वाले पैटर्न में सबसे पहले अगर मैं रोज

play24:49

देखूं तो यहां पर 7 रोज है तो मैं बोल

play24:51

सकती हूं की रोज के लिए मुझे वैन तू एंड

play24:53

जो है लूप चलाना पड़ेगा एंड कॉलम्स के लिए

play24:56

यहां पे अगेन सेवन कॉलम्स है तो 1 2 एंड

play25:00

अगेन मेरे को कॉलम के लिए लूप चलाना

play25:02

पड़ेगा मुझे प्रिंट क्या करना है

play25:04

प्रिंट मुझे मैं नंबर्स प्रिंट कर रही हूं

play25:07

एसेंडिंग ऑर्डर में ठीक है ये मुझे दिख

play25:10

रहा है यहां पे लेकिन यहां पे इंपॉर्टेंट

play25:13

बात यह है की जो स्टार्टिंग नंबर है जहां

play25:17

से मैं काउंटिंग स्टार्ट कर रही हूं हर रो

play25:19

में वो डिफरेंट है ठीक है यहां पर मैं वैन

play25:23

से स्टार्ट कर रही हूं फर्स्ट रो में

play25:25

सेकंड रूम में तू से स्टार्ट कर रही हूं

play25:28

थर्ड रो में मैं थ्री से स्टार्ट कर रही

play25:30

हूं एंड सो ऑन

play25:32

क्या मैं बोल सकती हूं की जो मेरा रोल

play25:34

नंबर है मैं उसी से अपनी काउंटिंग स्टार्ट

play25:37

कर रही हूं ठीक है यह पैटर्न हमने देख

play25:40

लिया है काफी आसानी से नोटिसेबल है तो मैं

play25:45

काउंटिंग जो है मेरे को समझ में ए गया की

play25:47

आई से स्टार्ट है ठीक है वह आई है अब यह

play25:54

आई कहां तक जा रहा है सबसे पहले हर हर रो

play25:57

में ये तो 7 तक तो जा रहा है ठीक है तो

play26:01

एंड तक ये जा रहा है आई तू एन हमारा जो है

play26:06

हम नंबर्स प्रिंट कर रहे हैं

play26:09

उसके बाद एन के बाद हमारा दोबारा लूप

play26:13

स्टार्ट हो रहा है वैन से ठीक है तो आई तू

play26:17

एन जो है हम प्रिंट कर रहे हैं सबसे पहले

play26:19

उसके बाद हम प्रिंट कर रहे हैं

play26:23

12 कहां तक

play26:28

वैन से

play26:30

काउंटिंग स्टार्ट करें एंड कहां तक प्रिंट

play26:33

कर रहे हैं हम यहां पर नहीं कुछ प्रिंट हो

play26:37

रहा है यहां पर हम बंद तक प्रिंट करें 2 3

play26:39

4 5 6 ठीक है तो कहां तक हमें प्रिंट करना

play26:43

है यह हम देख सकते हैं फोन नंबर पे ठीक है

play26:48

तो यहां पर हमारा रोल नंबर वैन है तो यहां

play26:51

पर हम सेवन के बाद कुछ नहीं प्रिंट कर रहे

play26:54

हैं यहां पर हमारा रोल नंबर तू है तो यहां

play26:57

पर

play26:58

प्रिंटर

play27:04

करना है

play27:06

रोल नंबर

play27:08

-1 तक मुझे इसको प्रिंट करना है नंबर्स को

play27:13

ठीक

play27:18

करना है

play27:26

काउंटिंग स्टार्ट करनी है एंड उसको लेकर

play27:29

जाना है कहां तक आई - 1 तक ठीक है अब ये

play27:34

जो मेरे को प्रिंट करना है आई से एन और

play27:37

फिर वैन तू आई माइंस वैन इसी को मैं उसे

play27:40

कर सकती हूं अपने अंदर वाले लूप्स के लिए

play27:42

ठीक है तो मैं यहां पे कॉलम्स के लिए अलग

play27:47

लूप नहीं लगाऊंगी मैं कॉलम को ही दो पार्ट

play27:50

में डिवाइड कर दूंगी पहले लूप लिखूंगी जो

play27:52

की

play27:53

जो एन तक काउंटिंग करेगा उसके बाद एक लूप

play27:57

जो की इनके बाद वाली कॉलम्स को प्रिंट कर

play28:00

रहा होगा ठीक है इसको कोर्ट में देखते हुए

play28:02

दोबारा और क्लेरिटी ए जाएगी तो यहां पर हम

play28:06

सबसे पहले इनपुट ले लेंगे यूजर्स से एन

play28:09

एंड लूप लगा देंगे रोज के लिए तो रोज

play28:13

हमारा वैन से लेकर एंड तक चल रहा है एंड

play28:16

कॉलम्स के लिए हम क्या करेंगे सबसे पहले

play28:20

एन तक का लूप लगा देंगे ठीक है तो जे = आई

play28:24

से लेकर के <= एन तक हमारा यह लूप चल रहा

play28:28

है जहां पे हम प्रिंट कर रहे हैं के हमारा

play28:31

जो भी कॉलम है

play28:39

एंड दें इसके बाद हमारा एक लूप चल रहा है

play28:42

जो की चल रहा है वैन से स्टार्ट हो रही है

play28:45

हमारी काउंटिंग एंड यह जा रहा है कहां तक

play28:53

यहां पर अगेन हम के जो है अपना प्रिंट कर

play28:56

देंगे

play29:01

इसको टर्न करते कोड को

play29:08

पैटर्न फाइव एंड प्रिंटेड फॉर 7 तो यही था

play29:15

हमारा पैटर्न राइट क्योंकि हमें चाहिए

play29:17

प्रिंट हो गया है इसको हम किसी और इनपुट

play29:21

के लिए भी टेस्ट कर सकते हैं नाइन तक के

play29:23

लिए टेस्ट कर सकते हैं

play29:34

यहां पर मैं 1 2 3 4 5 6 से जो है हमारा

play29:52

डिस्क्रिप्शन में

play29:54

और भी एक्स्ट्रा क्वेश्चंस है और उनके

play29:57

सॉल्यूशंस है तो वो खुद से पहले जरूर

play30:00

प्रैक्टिस करना अगर नहीं हो तो यू विल हैव

play30:03

डी सॉल्यूशंस इन डिस्क्रिप्शन

play30:32

क्वेश्चन दिए हो जाना चाहिए आप लोगों से

play30:34

नेक्स्ट क्वेश्चन पर बढ़ते हैं यह थोड़ा

play30:37

सा ट्रिकी

play30:38

क्वेश्चंस काफी आते हैं एंड इसमें एक

play30:42

नोटिस करने वाली चीज होती है सबसे पहले

play30:43

यहां पर इनपुट मैं बता देती हूं इनपुट जो

play30:46

है आपको कुछ दे रखा होगा इन और एम ठीक है

play30:51

यहां पे एन और एम दे रखा होगा एन जो है

play30:54

यहां पे फोर है और एम जो है वो सिक्स है

play30:58

अब यहां पर आप देखोगे दो चीज प्रिंट हो

play31:02

रही है या तो वैन प्रिंट हो रहा है या फिर

play31:04

तू प्रिंट हो रहा है अब इसको आप कैसे

play31:06

देखोगे की कहां पे वैन और कहां पे ट्रू

play31:09

सबसे पहले तो नोटिस करने वाली चीज ये है

play31:12

की हमारे दो चीज हैं जो प्रिंट हो रही है

play31:14

वैन या फिर तू

play31:17

ऐसी जगह पर जब आपको दो चीज जो है प्रिंट

play31:21

हो रही है तो यहां पर आप ऑर्डर एवं वाला

play31:25

कॉन्सेप्ट जो है वह उसे कर सकते हो

play31:32

अल्टरनेट पर आते हैं

play31:36

वैन के बाद तू ए रहा है तू के बाद वैन तो

play31:40

अगर आप हमारा जो किसी भी पॉइंट पे आपको रो

play31:44

नंबर पता होगा कॉलम नंबर पता होगा अब रो

play31:47

नंबर और कॉलम नंबर को लेकर उनको ऐड कर दो

play31:50

तो या तो उनका

play31:52

जो सैम आएगा या तो वो ओडी आएगा या तो वो

play31:56

एवं आएगा ठीक है तो उससे आप बता सकते हो

play32:00

की कहां पे वैन प्रिंट हो रहा है कहां पे

play32:02

तू ठीक है मैं क्या बोल रही हूं की ये जो

play32:05

फर्स्ट वैन है यहां पे मेरा

play32:08

जो रोल नंबर है वह

play32:11

कॉलम नंबर

play32:33

थ्री ए जाएगा जो की ओडी है

play32:37

तो सिमिलरली हर पोजीशन पे अल्टरनेट पे एवं

play32:41

आएगा फिर ऑर्डर आएगा सिमिलरली यहां पे

play32:45

मेरे को प्रिंट करना है वैन करना है फिर

play32:47

तू करना है फिर वैन करना है फिर तू करना

play32:49

है तो मैं बोल सकती हूं की यार जब भी मेरे

play32:51

को एवं ए रहा है आई प्लस दे वहां पे

play32:54

प्रिंट कर दो

play32:58

वहां पर प्रिंट कर दो

play33:36

सबसे पहले मैंने यूजर से इनपुट ले लिया

play33:48

सबसे पहले रोज के लिए क्या से कहां तक

play33:51

चलेगा वैन से लेकर

play33:53

इस इक्वल तू एन तक चलेगा

play34:06

ये हमें पता है बात क्या है की प्रिंट

play34:10

क्या करना है है ना तो प्रिंट क्या करना

play34:12

है ये देखने के लिए हम आई और के पे कंडीशन

play34:15

लगा रहे होंगे इफ हमारा आई प्लस के

play34:21

मॉडल और तू इस इक्वल तो जीरो

play34:26

है तो वहां पर हमें प्रिंट करना है वैन

play34:35

एंड एल्स वाले केस में हमें प्रिंट करना

play34:39

है तू

play34:42

एंड इसके बाद हम लगा देंगे नेक्स्ट लाइन

play34:54

यहां पर हम इनपुट दे देते हैं फोर एंड

play34:57

सिक्स एंड ये हमारा पैटर्न जो है वो

play35:00

प्रिंट हो गया है

play35:02

राइट दिख रहा है इसको दोबारा किसी और

play35:05

इनपुट के लिए प्रिंट करके देखते हैं 7 एंड

play35:08

9

play35:10

अगेन यह हमारा पैटर्न जो है जैसा हमें

play35:13

चाहिए था वैसे ही प्रिंट हो रहा है राइट

play35:14

तो कहीं पर भी अगर अल्टरनेट कुछ प्रिंट हो

play35:19

रहा है तो यू नो व्हाट तू डू ठीक है

play35:22

बढ़ते हैं नेक्स्ट पे जो की ये न्यूमेरिकल

play35:25

traangle ठीक है ये जो है यहां पे हमने

play35:28

स्टार्स वाला देखा था से पैटर्न में यहां

play35:30

पे न्यूमेरिकल्स है तो यहां पर आपको पता

play35:33

है अगर आप सिर्फ जो कॉलम नंबर है वो

play35:35

प्रिंट कर दोगे तो आपका ये पैटर्न जो है

play35:38

ये फॉर्म हो जाएगा है ना कॉलम नंबर तक जा

play35:41

रहा है यहां पे जो है कॉलम नंबर जो है वो

play35:43

तू तक जा रहा है एंड वही प्रिंट हो रहा है

play35:47

दिस इसे जस्ट लाइक हमने जो स्टार वाला

play35:50

क्वेश्चन किया था तो यह आप लोगों से हो

play35:51

जाना चाहिए

play36:00

हमसे हमने देखा था यही वाला एक्सरसाइज

play36:08

प्रिंट करने डालेंगे और उसके बाद हम कुछ

play36:11

नंबर स्प्रिंग कर रहे होंगे ठीक है तो जो

play36:14

सिमिलर पार्ट हम सिमिलर वाला पार्ट है वो

play36:16

तो सबसे पहले देख लेते हैं ये वाला इनपुट

play36:19

अगेन हमें एन = 4 के लिए दे रखा है हमारा

play36:22

रोज जो है वो हम वैन तू एंड जो है उसके

play36:26

लिए लूप चला रहे होंगे एंड हमारे कॉलम्स

play36:29

जो है उसको हमने दो पार्ट्स में डिवाइड कर

play36:31

दिया स्पेस और जो भी हमें नंबर प्रिंट

play36:34

करना है

play36:36

स्पेस उतनी ही प्रिंट और जैसे स्पेस जैसे

play36:40

की हमारा स्टार वाले क्वेश्चन में हो रहा

play36:42

था तो 12

play36:45

एन - हमारा जो भी रो नंबर है वहां तक हम

play36:50

अपनी स्पेस प्रिंट कर रहे होंगे अब जो

play36:53

नंबर है यार नंबर हमें प्रिंट तो करना है

play36:56

लेकिन नंबर आप यह देखो सबसे पहले

play36:59

इंक्रीजिंग ऑर्डर में नंबर प्रिंट हो रहा

play37:01

है और फिर डिक्रीजिंग ऑर्डर में नंबर हो

play37:04

रहा है ठीक है

play37:09

जो हमने नंबर प्रिंट करना है उसको दो

play37:11

पार्ट्स में डिवाइड कर देते हैं सबसे पहले

play37:13

इंक्रीजिंग ऑर्डर और फिर डिक्रीजिंग ऑर्डर

play37:18

जो इंक्रीजिंग ऑर्डर वाला जो हमें प्रिंट

play37:21

करने नंबर वह कहां तक प्रिंट हो रहा है

play37:24

कहां तक प्रिंट हो रहे हैं वह

play37:28

कहां तक प्रिंट हुए वह प्रिंट हो रहे हैं

play37:31

मेरे रोल नंबर तक ठीक है मेरा रोल नंबर

play37:33

यहां पर

play37:35

है

play37:38

इंक्रीजिंग ऑर्डर में प्रिंट हो रहा है

play37:40

ठीक है तो मैं इंक्रीजिंग ऑर्डर के लिए

play37:42

बोल सकती हूं की मेरे को 1 2 आई तक प्रिंट

play37:46

करना है ठीक है

play37:51

रोल नंबर तक प्रिंट हो गए उसके बाद मैं

play37:54

क्या करूं फर्स्ट रो में तो मेरे को कुछ

play37:57

नहीं

play38:14

कुछ स्टार्ट करना है प्रिंट करना उसके लिए

play38:17

आप क्या देख सकते हो

play38:20

आई - 1 से लेकर वैन तक मैं प्रिंट कर रही

play38:24

हूं ठीक है यहां पर मेरा आई जो है वो फोर

play38:27

है राइट आई = 4 है दें फोर के बाद आई -

play38:33

4i - 1 क्या हुआ थ्री तो थ्री से वैन तक

play38:38

मैं यहां पे प्रिंट कर रही हूं सिमिलरली

play38:40

यहां पे आई क्या है थ्री थ्री माइंस वैन

play38:42

मतलब तू तो तू से वैन तक मैं यहां पे

play38:45

प्रिंट कर रही हूं एंड यहां पे आई एम

play38:48

प्रिंटिंग तिल वैन ओनली वैन से वैन तक एंड

play38:52

यहां पे नथिंग ठीक है आई - 1 यहां पे जीरो

play38:57

हो जाएगा ठीक है तो जो डिक्रीजिंग ऑर्डर

play39:01

में मुझे प्रिंट करने है नंबर्स वो मुझे

play39:03

प्रिंट करने है आई - 1 से लेकर

play39:09

वैन तक ठीक है तो यहां पर जो मैं लूप

play39:12

लगाऊंगी वह डिक्रीजिंग लूप होगा जहां पर

play39:15

मेरी जो के के वैल्यू है वह डिक्रीज हो

play39:18

रही होगी आई - 1 से लेकर 1 तक ठीक है तो

play39:22

इसको भी एक बार भी देख लेते हैं कोर्ट में

play39:48

तो इसको भी बड़ी देख लेते हैं कोर्ट में

play39:51

हमें इनपुट जो है यहां पर एंड दे रखा होगा

play40:10

वैन से लेकर लेस दें इक्वल तू

play40:16

एन - आई तक

play40:20

राइट एंड यहां पर हम प्रिंट कर रहे हैं

play40:23

स्पेस इसके बाद हमारा लूप लगेगा जो की

play40:28

चलेगा हमारे एसेंडिंग नंबर्स के लिए तो वह

play40:31

हमने देखा था जी इस इक्वल तू वैन से लेकर

play40:34

के

play40:37

<= हान सॉरी आई तक हमारा लूप चलेगा एंड

play40:42

यहां पे हम प्रिंट कर रहे हैं

play40:47

इसके बाद डिसेंडिंग नंबर्स के लिए हम अगेन

play40:50

एक और लूप लगा देते हैं जो की चलेगा आई -

play40:54

1 से यह स्टार्ट होगा एंड यह जलेगा जब तक

play40:58

जी इस मोर दें इक्वल तू वैन

play41:05

यहां पर अगेन हम जेब प्रिंट करें उसके बाद

play41:08

हम लगा देंगे

play41:19

यहां पर इनपुट में दे रही हूं 4 एंड यही

play41:24

था हमारा पैटर्न रेड इसको एक और इनपुट के

play41:27

लिए टेस्ट करते हैं

play41:31

लास्ट रो में हमारा एट तक जा रहा है और

play41:33

उसके बाद सेवन से मैन तक इसके बाद वाला जो

play41:37

क्वेश्चन है वो होलो ट्रायंगुलर पैटर्न है

play41:40

यहां पर आपको कुछ नहीं करना है जैसे की हम

play41:45

होलो रैक्टेंगुलर उसे कर रहे द वैसे ही

play41:47

होल्डर ट्रायंगुलर है यहां पे ठीक है तो

play41:50

फर्स्ट और लास्ट वाले प्लेसिस पर हम नंबर

play41:52

जो है वो प्रिंट कर रहा है उसके अलावा

play41:55

बाकी प्लेसिस में हम स्पेस प्रिंट कर रहे

play41:57

हैं ठीक है तो यह क्वेश्चन आई होप आप सबसे

play41:59

हो जाना चाहिए

play42:04

प्रैक्टिस कर लीजिए जितने आप करोगे उतने

play42:08

कम है एंड पैटर्न क्वेश्चंस से आपके लूप्स

play42:11

के कॉन्सेप्ट जो है वो बहुत ज्यादा क्लियर

play42:13

हो जाएंगे ठीक है तो आज की वीडियो में बस

play42:16

इतना नेक्स्ट वीडियो में हम और क्वेश्चंस

play42:19

कर रहे होंगे लूप्स में जब तक लूप से

play42:22

बिल्कुल ही पाक नहीं जाओगे तब तक हम

play42:24

क्वेश्चंस करते रहेंगे लूप्स में ठीक है

play42:26

तो मिलते हैं नेक्स्ट वीडियो में थैंक यू

play42:28

एंड बाय बाय

Rate This

5.0 / 5 (0 votes)

Related Tags
Loop PatternsProgramming TutorialProblem SolvingNested LoopsCode ImplementationPattern QuestionsNumerical PatternsEducational ContentSkill DevelopmentTechnical Learning