MD. Sakib Khan

Forum Replies Created

Viewing 9 posts - 76 through 84 (of 84 total)
  • Author
    Posts
  • in reply to: Assignment 5.11 #94692
    User AvatarMD. Sakib Khan
    Participant

    A little Mistake in the conditions.
    In the outer loop, the condition should be row <= 5
    And in the inner loop, the condition should be col <= row
    Rest of the code is okay.
    Let me know if you understand the problem.

    in reply to: Assignment Question no-3 #94685
    User AvatarMD. Sakib Khan
    Participant

    You are mentioning Question 3 in the title, but in the problem description, you are saying Question 5. Can you please tell me, In which one you are facing problem to solve?

    in reply to: Assignment Question no-3 #94671
    User AvatarMD. Sakib Khan
    Participant

    Problem: 5 is kind of mixture of Exercise: Even Odd Numbers and Exercise: Sum of Numbers

    For getting the sum of even numbers, your loop variable should start with 2. Because the first even number is two.
    And every time when the loop ends, increase its value with 2 until its value reaches 100. (2, 4, 6, 8, 10, … ,100)
    like that,

    for(let index = 2; index <= 100; index += 2) {

    }

    and For getting the sum of odd numbers, your loop variable needs to start with 1. like that,
    for(let index = 1; index <= 100; index += 2) {

    }

    Here are the solutions:
    Even Sum: https://photos.app.goo.gl/3DSKfy1ckREbBfWQ7
    Odd Sum: https://photos.app.goo.gl/WtgB8LWVwAUdXYoj9

    Let me know if it helps you.

    in reply to: Assignment #94665
    User AvatarMD. Sakib Khan
    Participant

    Hi Suresh,

    Thank you for your proposal. I am currently working on that. On 23 September, I’ll publish lots of new videos and in there, I’ll show you where to submit the assignments and where you’ll get all the solutions.

    Regarding the discussion, Many of my students are also telling me about a discussion group. I will share with you a slack/discord group where you can discuss problems with me or each other. (There will be an announcement on 23 September. Stay Tuned!)

    Thank you

    in reply to: Assignment 5.11 #94359
    User AvatarMD. Sakib Khan
    Participant

    Hi Sami,

    For solving these kinds of pattern problems, you have to use Nested Loops.
    For each row, you have to use a loop (Outer loop) and for each column, you have to use another nested loop (Inner Loop)

    And for placing the numbers/stars side by side in a row, follow these steps:
    (I) Take a variable [In my code, it is Pattern]
    (II) Every time when the loop starts, initialize the variable with an empty string (”)
    (III) Add the numbers/stars with it.

    Here is my Solution:
    Star Patterns: https://photos.app.goo.gl/y8fEooUXi1iZby1m8
    Number Patterns: https://photos.app.goo.gl/uE2w2G8NudfEc7sK9

    As you can see, Each solution is kind of similar with slide differences. You just need to understand, Is the loop variable incremental or decremental. That’s it.

    Let me know brother if you understand the way to solve these kinds of problems.

    Thank you.

    in reply to: Assignment Problem #92724
    User AvatarMD. Sakib Khan
    Participant

    Hi Mustakim,

    To solve this problem, You need to follow these steps:
    i) Take a Sum Variable
    ii) Add the last digit of the number (If a number is divided by 10, its remainder (ভাগশেষ) is the last digit of that number)
    iii) Remove the last digit (Just divide it by 10)
    iv) Repeat from step (ii) until the number is zero.
    v) You will get the sum.

    Here is the solution: https://photos.app.goo.gl/iGEvFYNyXav2LTHz9

    Let me know if it helps you.
    Thanks.

    in reply to: ternary operators #92712
    User AvatarMD. Sakib Khan
    Participant

    Hi Sami,
    Yes, you can solve this problem using Ternary Operators.
    Here is the solution: https://photos.app.goo.gl/C31TQMGjr8YP9MTPA
    Logic is same as before. If you don’t understand, let me know.
    But we shouldn’t do like that. This is pretty ugly and not understandable code.
    When the problem needs only if…else to solve,then we should use ternary operators.
    If number of conditions is greater than two, then we should use if..else if.. else

    in reply to: VS code auto copy-paste keyboard shortcut #92434
    User AvatarMD. Sakib Khan
    Participant

    Is your question, How can we copy a line of code, and paste it multiple times?
    you can just go to a line and press Ctrl+C (It will copy the whole line) and then press Ctrl+V multiple times. It will paste the codes in new lines.

    If you are searching something like that, if you write cons and then VS Code will auto-complete your code/give you some suggestions, for that you can install a extension (Just like you’ve installed Live Server), It is JavaScript (ES6) Code Snippets

    And in VS Code, You can select all the occurrences of a portion of code using Ctrl+D

    in reply to: VS code auto copy-paste keyboard shortcut #92424
    User AvatarMD. Sakib Khan
    Participant

    Hi Suresh brother,
    Welcome to this course and I am very very happy to see your progress.

    Here is the keyboard shortcuts:
    Ctrl + X for CUT
    Ctrl + C for COPY
    Ctrl + V for PASTE
    Ctrl + Z for UNDO

    By these shortcuts, you can also cut,copy,paste the whole line of the code in VS Code.
    Let me know if it works for you 

Viewing 9 posts - 76 through 84 (of 84 total)