American Young Coder Academy – Indo

Loading Events

« All Events

  • This event has passed.

2:30 PM – Intro To Competitive Programming – Gamas

September 16, 2023 @ 2:30 pm - 3:30 pm

Homework
  1. Create Sep16ArrayHomework.java
    1. Create a new int array(6) (“numbers”) and add the following values: -100,2,3,100,-5,14
    2. Create a new int array(20) (“bigCapacityNumbers”) and use for loop to copy all elements from “numbers” to “bigCapacityNumbers”
    3. Add code to count how many negative numbers inside the “numbers” array. Hint: you have to use for loop and if statement.
    4. Study this modulus operator – https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/what-is-modular-arithmetic
    5. Modulus (%) is an operator that is supposed to give you a reminder of a division. Copy below codes and run it
      1. class ModulusOperator {
            public static void main(String[] args) {
                int num1, num2, result;
                num1 = 26;
                num2 = 15;
                System.out.println("num1=26; num2=15");
                result = num1 % num2;
                System.out.println("The result after modulus operation is : " + result);
            }
        }
    6. After you learn how to use modulus in Java, write a code that will go through each element inside “numbers” and print all odd number inside the list using modulus (%) operator.

Details

Date:
September 16, 2023
Time:
2:30 pm - 3:30 pm
Verified by MonsterInsights