1. Find the number within 100 and 7, and print
Single digit is 7 a%10==7
The 10-digit number is 7 a/10==7
Can be divisible by 7 a%7==0
for (int i = 1; i <=; i++)
{
if (i% = = 7 | | i/10 = 7 | | I% 7 = = 0)
{
Console.Write (i + "t");
}
}
Console.ReadLine ();
2. Summation sum
Console.Write ("Please enter a positive integer:");
int a = Int. Parse (Console.ReadLine ());
int sum = 0;
for (int i = 1; i <= A; i++)
{
Sum + = I;//sum=sum+1
}
Console.WriteLine (sum);
Console.ReadLine ();
2. Enter a positive integer to find the factorial
Console.Write ("Please enter a positive integer:");
int a = Int. Parse (Console.ReadLine ());
int jie = 1;
for (int i = 1; i <= A; i++)
{
Jie *= i;//jie=jie*i
}
Console.WriteLine (Jie);
Console.ReadLine ();
3. Seeking factorial and
Console.Write ("Enter a positive integer:");
int a = Int. Parse (Console.ReadLine ());
int sum = 0;
int jie = 1;
for (int i = 1; i <= A; i++)
{
Jie *= i;
sum + = Jie;
}
Console.WriteLine (sum);
Console.ReadLine ();
4, a game, the first 20 off is the score of each off
21~30 off, 10 points per pass
31~40 off, 20 points per pass
41~49 off, 30 points per pass
50 off, it's 100 minutes.
Enter the current number of levels to find the current score
Method One:
Console.Write ("Please enter your number of levels:");
int a = Int. Parse (Console.ReadLine ());
if (a>=1 && a<=50)
{
int sum = 0;
for (int i=1;i<=a; i++)
{
if (I <= 20)
{
Sum + = I;//sum=sum+1
}
else if (i<=30)
{
Sum + = 10;//sum=sum+10
}
else if (I <= 40)
{
Sum + = 20;//sum=sum+20
}
else if (I <= 49)
{
Sum + = 30;//sum=sum+30
}
Else
{
Sum + = 100;//sum=sum+100
}
}
Console.WriteLine (sum);
}
Else
{
Console.WriteLine ("The number of levels you have entered is incorrect!) ");
}
Console.ReadLine ();
Method Two:
Console.Write ("Please enter your number of levels:");
int a = Int. Parse (Console.ReadLine ());
if (a>=1 && a<=50)
{
int sum = 0;
if (a<= 20)
{
for (int i=1;i<=a; i++)
{
Sum + = I;//sum=sum+1
}
}
else if (a<=30)
{
for (int i = 1; i <=; i++)
{
Sum + = I;//sum=sum+1
}
for (int i=21; I <= A; i++)
{
sum + = 10;
}
}
else if (a <= 40)
{
for (int i = 1; i <=; i++)
{
Sum + = I;//sum=sum+1
}
for (int i = +; I <=; i++)
{
sum + = 10;
}
for (int i=31;i<=a; i++)
{
sum + = 20;
}
}
else if (a <= 49)
{
for (int i = 1; i <=; i++)
{
Sum + = I;//sum=sum+1
}
for (int i = +; I <=; i++)
{
sum + = 10;
}
for (int i = +; I <=; i++)
{
sum + = 20;
}
for (int i = <=; I, A; i++)
{
sum + = 30;
}
}
Else
{
for (int i = 1; i <=; i++)
{
Sum + = I;//sum=sum+1
}
for (int i = +; I <=; i++)
{
sum + = 10;
}
for (int i = +; I <=; i++)
{
sum + = 20;
}
for (int i = <=; i; i++)
{
sum + = 30;
}
sum + = 100;
}
Console.WriteLine (sum);
}
Else
{
Console.WriteLine ("The number of levels you have entered is incorrect!) ");
}
Console.ReadLine ();
Find the number that is within 100 and 7, and print
Single digit is 7 a%10==7
The 10-digit number is 7 a/10==7
Can be divisible by 7 a%7==0
for (int i = 1; i <=; i++)
{
if (i% = = 7 | | i/10 = 7 | | I% 7 = = 0)
{
Console.Write (i + "t");
}
}
Console.ReadLine ();
Loop statement for Practice