First section 1-for Cycle introduction
Grammar:
for (conditional expression)
{
EXECUTE statement
}
Practice:
Chapter III Operations
1. Write a program to print values from 100 to 200;
2. Write a program to print from 10 to 1;
3. Write a program to print all even numbers between 10 and 30
Section II 2-declaration and assignment of variables, scope of variables
Section three for loops
Grammar:
while (conditional expression)
{
EXECUTE statement
}
Arithmetic progression 1+n=n* (n+1)/2
Fifth section while loop, first judge and then execute
1. A question during the interview
int i=0;
while (i<=5)
{
Console.WriteLine (i++);//Output 0 to 4, first take the value of I and then self-increment
Console.WriteLine (++i);//Output 1 to 5, first self-increment and then take the value of I
}
Section sixth do. While loop, perform a second judgment first, at least once
Grammar:
Do
{
EXECUTE statement
}
while (conditional expression)
1.break closing the nearest loop
2.continue Close the loop and proceed to the next cycle
Section Seventh Declaration and use of arrays
Grammar:
data type [] array name =new data type [number];
Int[] Arr=new int[5];
Eighth Section Array
When an int array is uninitialized, the default is 0
Default is null when an array of strings is not initialized
Introduction to the 12th section method
1. Method/function is a meaning
Method is a code snippet that can be reused
Overload: As long as the number of parameters or different types of parameters;
2. You cannot have overloaded methods that are just different names of parameters
3. Whether the method overload and the return value are irrelevant;
16th section variable-length array
The params must be the last parameter
Chapter III C # Loops and methods