我的想法是: 定义一个空数组. for (int i = 0; i <= 100; i++) 数组添加 i if判断 i % 10 结果是否为整数. 是的话输出.接着清空数组
public int counts = 0;
public void test() { for (int i = 0; i < 100; i++) { counts++; if (counts==10) { Response.Write(""); counts = 0; } } }
var content = ""; var cnt = 0; var arrayNum = []; for (var i = 1; i <= 100; i++) { arrayNum.push(i); if (i % 10 == 0) { cnt++; for (var y in arrayNum) { content += arrayNum[y] + ","; } content += "第" + cnt + "段分组 "; arrayNum.length = 0; } } document.write(content); JS写的.上班太闲了.突然发现C#写代码好象不会了.......
string bianliang = ""; for (int i = 1; i <= str.Length; i++) { bianliang += str[i]; if (i % 10 == 0) { i = i - 10; for (int i = 0; i < 10; i++) { Console.Write(str[i]); }
} }
错了,试试这个…… string bianliang = ""; for (int i = 1; i <= str.Length; i++) { bianliang += str[i]; if (i % 10 == 0) { int j = i; j = j - 9; for (int h = j; h <= j+9; h++) { Console.Write(str[h]); }
} }
for (int i = 0; i < 100; i++) { counts++; if (counts==10) { Response.Write(""); counts = 0; } } }
string bianliang = ""; for (int i = 0; i < str.Length-1; i++) { bianliang += str[i]; if (i != 0) { if (i % 9 == 0) { int j = i; j = j - 9; for (int h = j; h <= j + 9; h++) { Console.Write(str[h]); } } } } 输出十个数,应该是余9
int[] intArray= new int[100]; //假设为100 int[] intTemp = new int[10]; int count=intArray.Length; for (int i = 0; i < count; i++) { int j= i%10 + 1; //j:[1,10] intTemp[j - 1] = intArray[i]; //赋值给intTemp if (j==10) { //输出intTemp } }
定义一个空数组.
for (int i = 0; i <= 100; i++)
数组添加 i
if判断 i % 10 结果是否为整数.
是的话输出.接着清空数组
public void test()
{
for (int i = 0; i < 100; i++)
{
counts++;
if (counts==10)
{
Response.Write("");
counts = 0;
}
}
}
var content = "";
var cnt = 0;
var arrayNum = [];
for (var i = 1; i <= 100; i++) {
arrayNum.push(i);
if (i % 10 == 0) {
cnt++;
for (var y in arrayNum) {
content += arrayNum[y] + ",";
}
content += "第" + cnt + "段分组 ";
arrayNum.length = 0;
}
} document.write(content);
JS写的.上班太闲了.突然发现C#写代码好象不会了.......
for (int i = 1; i <= str.Length; i++)
{
bianliang += str[i];
if (i % 10 == 0)
{
i = i - 10;
for (int i = 0; i < 10; i++)
{
Console.Write(str[i]);
}
}
}
string bianliang = "";
for (int i = 1; i <= str.Length; i++)
{
bianliang += str[i];
if (i % 10 == 0)
{
int j = i;
j = j - 9;
for (int h = j; h <= j+9; h++)
{
Console.Write(str[h]);
}
}
}
{
counts++;
if (counts==10)
{
Response.Write("");
counts = 0;
}
}
}
for (int i = 0; i < str.Length-1; i++)
{
bianliang += str[i];
if (i != 0)
{
if (i % 9 == 0)
{
int j = i;
j = j - 9;
for (int h = j; h <= j + 9; h++)
{
Console.Write(str[h]);
}
}
}
}
输出十个数,应该是余9
int[] intTemp = new int[10];
int count=intArray.Length;
for (int i = 0; i < count; i++)
{
int j= i%10 + 1; //j:[1,10]
intTemp[j - 1] = intArray[i]; //赋值给intTemp
if (j==10)
{
//输出intTemp
}
}
if(i==10){
//做您要做的事情
break;
}
}
嗨,老兄我问你,很难吗。
if(i==10){
//做您要做的事情
continu;//查下,这个事继续执行的
}
}
嗨,老兄我问你,很难吗。
而且continu;没用
{
if (...)
{
...
}
}