Home > Net >  How to use c # programming output all of 300-800 can be divided exactly by 6?
How to use c # programming output all of 300-800 can be divided exactly by 6?

Time:11-19

How to use c # programming output all of 300-800 can be divided exactly by 6?

CodePudding user response:

 
Var q=Enumerable. Range (300, 800-300). The Where (d=& gt; 6 d %==0);
Console. WriteLine (" can be divided exactly by 6 have these "+ string. Join (",", q));

CodePudding user response:

XXX XXX %==0 6 output

CodePudding user response:

using System;
The namespace HelloWorldApplication
{
The class HelloWorld
{
The static void Main (string [] args)
{
For (int I=300; I<=800; I++)
{
If (I % 0==6) Console. WriteLine (I);
}

The Console. ReadKey ();
}
}
}

CodePudding user response:

Algorithm, to think about it, just don't realize, the most you can think of way, of course, is the cycle from 300 to 800, each number and 6 o, if it is 0, that is,
If it is hit the first and the number of more than 6 o=0, 300 for example, that the following number is 300 * 1300 * 2300 + 6 + 6 + 6 * 3... To the more than 800 exit,

CodePudding user response:

This problem should also be in CSDN?
  •  Tags:  
  • C#
  • Related