Nested loops in C | Chapter 5 | Class 10 Computer Science 571(NCERT) Question and Answer |  Class 10 Computer Science 571(NCERT) Question and Answer Solutions English medium |


Nested loops in C

Chapter 5 


1. Write C programs to display the following patterns using nested loop construct.

 (নেষ্টেড লুপ কনষ্ট্ৰাক্ট ব্যৱহাৰ কৰি নিম্নলিখিত পেটাৰ্ণবোৰ প্ৰদৰ্শন কৰিবলৈ চি প্ৰ'গ্ৰামলিখক।)

a. 1    2    3

    1    2    3

     1     2    3

     1    2    3

    1    2      3

Ans: 

b. 1    2    1

    1    2    1

    1    2    1

    1    2    1

    1    2    3

Ans:

C. 4    3    2    1

     4    3    2    1

     4    3    2    1

      4    3    2    1

       4    3    2    1

Ans:

d.         2

       2    3    4 

2     3     4    5    6  

Ans:

e.         1

        1    2    1

1       2    4    5    6

Ans:

f.                *

            *   *    * 

      *   *    *   *   *

 *   *   *   *   *   *   *

   *    *      *    *   *

        *     *     * 

                *

Ans: 

g.

X                                                                X

X   X                                                          X     X

X    X     X                                                 X      X     X

X     X      X     X                                        X      X      X      X

X      X     X      X     X                              X       X      X       X     X

Ans:

2. Modify the solution of question no. I to accept the number of lines as the input. The program should make the display pattern accordingly (Hint: write separate programs). 

(প্ৰশ্ন নংৰ সমাধান সংশোধন কৰক। মই শাৰীৰ সংখ্যাক ইনপুট হিচাপে গ্ৰহণ কৰিম। প্ৰ'গ্ৰামটোৱে সেই অনুসৰি ডিচপ্লে পেটাৰ্ণ প্ৰস্তুত কৰিব লাগে (ইঙ্গিত: পৃথক প্ৰ'গ্ৰাম লিখক)। 

Ans: 

3. Extend the programs of Example 5.6 and Example 5.7 to make it dynamic by accepting the number of lines as an input from the keyboard.

কী-বোৰ্ডৰ পৰা ইনপুট হিচাপে শাৰীৰ সংখ্যা গ্ৰহণ কৰি ইয়াক গতিশীল কৰিবলৈ উদাহৰণ 5.6 আৰু উদাহৰণ 5.7-ৰ প্ৰ'গ্ৰামবোৰ সম্প্ৰসাৰিত কৰক।

4. what is a nested loop? Why do one use nested loops in our programs?

নেষ্টেড লুপ কি? আমাৰ প্ৰ'গ্ৰামবোৰত এজনে নেষ্টেড লুপ কিয় ব্যৱহাৰ কৰে?

5. Do we need to use same type of loops as outer and inner loops? Justify your answer with some code segments.

আমি বাহিৰৰ আৰু ভিতৰৰ লুপৰ দৰে একে ধৰণৰ লুপ ব্যৱহাৰ কৰিব লাগিব নেকি? কিছুমান কোড খণ্ডৰ সৈতে আপোনাৰ উত্তৰটো ন্যায়সঙ্গত কৰক।


6. Can we put a third loop inside the inner loop of a nested loop constract? Write a C program to justify your answer.

আমি এটা নেষ্টেড লুপ কনষ্ট্ৰাক্টৰ ভিতৰৰ লুপৰ ভিতৰত তৃতীয় লুপ এটা ৰাখিব পাৰোঁনে? আপোনাৰ উত্তৰটো ন্যায়সঙ্গত কৰিবলৈ এটা চি প্ৰ'গ্ৰাম লিখক।



Type & Assamese Translate : Himashree Bora.