Day 13
Hello
Continuing what I learned yesterday, today I learned how to print numbers, for example from 1 to 10
I know that it seems simple and useless at first glance, but we will need it later and it is possible to change it according to the command I want
In the example that I learned, which is printing from 0 to 10, I used the for loop that I learned yesterday and used i++, so the code was like thisfor (int i=0 ; i<=10 ; i++)
This code prints the numbers in sequence from 0 to 10, and I also learned how to print even numbers from 0 to 10, which is by writing the code in this form
for (int i=0 ; i<=10 ; i+=2)
It will print (0,2,4,6,8,10) consecutively
And the odd numbers also through this code
for (int i=1 ; i<=10 ; i+=2)
It will print (1,3,5,7,9) consecutively
And I also learned how to write it Descending is a little bit ascending and this is its code
for (int i=10 ; i<=0 ; i--)
It may be simple but these are ideas that will make it easier for me to make the program later
تعليقات
إرسال تعليق