Day 7


 Hello again

Today I learned and created a code to know if the number is even or odd and positive or negative and I wrote the code myself after listening to the explanation and this image is from my NetBeans program and the code is from my writing

As you can see, I used the if condition in this code as shown and I will explain this code in the following steps.

Line 10 is the first if condition I used in the code and it is to detect the entered number if it is greater than 0, meaning it is positive.

Line 11 tests the number if it is divisible by or vice versa and the correct result is even.

Lines 11 and 12 are to print that the entered number is positive and even if it succeeds in the first two operations.

Line 16 is a continuation of the if condition in line 11, if it does not meet the condition in line 11, it prints that it is odd or negative.

As for line 20, if the condition in sugar 10 is not met, it prints that it is negative.

In line 21, 26, it reveals whether the negative number is even or odd in the same way as before and prints that it is a negative odd number or a negative even number. This is today's code and I did not face any problems or errors today and this is a good thing because I started learning from my mistakes and not repeating them and we are waiting together for tomorrow's blog

تعليقات

المشاركات الشائعة