do {
//实现累加求和
if(num%2==0){
}sum=sum+num;
num = num + 2; // 每执行一次将数值加2,以进行下次循环条件判断
} while ( num<=50 ); // 满足数值在 1-50 之间时重复执行循环
System.out.println(" 50以内的偶数之和为:" + sum );
}
}
//实现累加求和
if(num%2==0){
}sum=sum+num;
num = num + 2; // 每执行一次将数值加2,以进行下次循环条件判断
} while ( num<=50 ); // 满足数值在 1-50 之间时重复执行循环
System.out.println(" 50以内的偶数之和为:" + sum );
}
}
2015-02-03
int i = 1;
while (i<=5)
{System.out.println(i);i++;}}}
while (i<=5)
{System.out.println(i);i++;}}}
2015-02-02