Sequential selection Loops
Loop for
for (;;)//Dead Loops
//{
//}
Break jumps out of the loop body
Continue end this cycle, continue the next cycle
Print 20 times Hello
for (int a=1;a<=20; a++)
//{
Console.WriteLine ("Hello");
//}
Enter an integer that calculates the number from 1 plus to the
Console.Write ("Please enter a positive integer");
int a = Int. Parse (Console.ReadLine ());
int s = 0;
for (int i = 1; I <= a;i++)
//{
s + = i; S=s+1
//}
Console.WriteLine (s);
Enter a positive integer to find the factorial of the number
Console.Write ("Please enter a positive integer:");
int a = Int. Parse (Console.ReadLine ());
int s = 1;
for (int i = 1; I <= a;i++)
//{
s *= i;
//}
Console.WriteLine (s);
Console.Write ("Please enter a positive integer:");
int a = Int. Parse (Console.ReadLine ());
int s = 1;
for (int i = A; I >= 1; i--)
//{
s *= i;
//}
Console.WriteLine (s);
Find out 100 of the numbers in relation to 7, print out
Multiples of 7
The single digit is 7.
The 10-digit number is 7.
int a = 0; Tag variables
for (int i = 1; i <=; i++)
//{
if (i% 7 = = 0 | | I% = = 7 | | i/10 = = 7)
// {
A++;//a=a+1
Console.WriteLine (i);
// }
//}
Console.WriteLine (a);
//First 20 off each level is its own score
21-30, 10 points per pass
31-40 each off 20
41-49, 30 per pass
50 off 100
Enter the number of points you've reached now, and please score now.
if nested for or for nested if
//console.write ("Please enter your closing number:");
//int a = Int. Parse (Console.ReadLine ());
//int b = 0;
//if (a <= && a >= 1)
//{
//if (a <=)
// {
//for (int i = 1; i <= A; i++)
// {
//b + = i;
// }
// }
/Else if (a >= && a <=)
// {
//for (int i = 1; i <=; i++)
// {
//b + = i;
// }
//for (int i = +; I <= A; i++)
// {
//b + = ten;
// }
// }
/Else if (a >= && a <=)
// {
//for (int i = 1; i <=; i++)
// {
//b + = i;
// }
//for (int i = +; I <=; i++)
// {
//b + = ten;
// }
//for (int i = +; I <= A; i++)
// {
//b + +;
// }
// }
/Else if (a >= && a <=)
// {
//for (int i = 1; i <=; i++)
// {
//b + = i;
// }
//for (int i = +; I <=; i++)
// {
//b + = ten;
// }
//for (int i = +; I <=; i++)
// {
//b + +;
// }
//for (int i = <=; i; i++)
// {
//b + = +;
// }
// }
//Else
// {
//for (int i = 1; i <=; i++)
// {
//b + = i;
// }
//for (int i = +; I <=; i++)
// {
//b + = ten;
// }
//for (int i = +; I <=; i++)
// {
//b + +;
// }
//for (int i = <=; i; i++)
// {
//b + = +;
// }
b + = 100;
// }
//}
Else
//{
Console.WriteLine ("No such off");
//}
Console.WriteLine (b);
Console.ReadLine ();
//console.write ("Please enter your closing number:");
//int a = Int. Parse (Console.ReadLine ());
//int b = 0;
//if (a>=1&&a<=50)
//{
//for (int i = 1;i<=a;i++)
// {
//if (I>=1&&I<=20)
// {
//b + = i;
// }
/Else if (i>=21&&i<=30)
// {
//b + = ten;
// }
/Else if (i >= && i <=)
// {
//b + +;
// }
/Else if (i >= && i <=)
// {
//b + = +;
// }
//Else
// {
//b + +;
// }
// }
//}
//else
//{
//Console.WriteLine ("Input Error");
//}
//console.writeline (b);
//console.readline ();
100 staircase, 0-49 knots is equal to the number of knots 50 (including 50) 10 points per section
Enter the number of sections to score
Console.Write ("Please enter the number of stair sections:");
int a = Int. Parse (Console.ReadLine ());
int b=0;
if (a >= 0 && a <= 100)
//{
for (int i = 0; I <= a;i++)
// {
if (i >= 0 && i <= 49)
// {
b + = i;
// }
else if (i>=50&&i<=100)
// {
B + = 10;
// }
// }
//}
Else
//{
Console.WriteLine ("Input Error");
//}
Console.WriteLine (b);
Console.ReadLine ();
C # class Fourth exercises