public class test
{
public static void main(String args[])
{ int i,s,k;
int z=0;
for (int i=1,i<93, i++ )
for (int s=2,s<=47, s++ )
for (int k=5,k<=19, k++ )
{ if( i+s*2+k*5==100)
{System.out.println(i+s*2+k*5);
z++;}}
System.out.println(z);
}
}
把int i,s,k;去掉,或者去掉循环里面的变量类型定义。提示应该是重复定义重名变量了
public class fact
{
public static void main(String args[])
{ int i,s,k;
int z=0;
for ( i=1;i<93; i++ )
{
for (s=2 ;s< 48; s++ )
{
for (k=5;k<20;k++)
{
if( i+s*2+k*5==100)
{
System.out.println(i+s*2+k*5);
}
z++;
}
}
System.out.println(z);
}
}
}