public class Shenweiqi{
public static void main(String[] args){
int score=53;
int count=0;
System.out.println("加分前的成绩"+score);
for(;score<60;score++,count++){
}
System.out.println("加分后的成绩"+score);
System.out.println("共加了"+count+"次");
}
}
public static void main(String[] args){
int score=53;
int count=0;
System.out.println("加分前的成绩"+score);
for(;score<60;score++,count++){
}
System.out.println("加分后的成绩"+score);
System.out.println("共加了"+count+"次");
}
}
public class Shenweiqi{
public static void main(String[] args) {
System.out.println("打印直角三角形");
for(int i=1;i<=3;i++){
for(int j=1;j<=i;j++){
System.out.print("*");
}
System.out.println();
}
}
}
public static void main(String[] args) {
System.out.println("打印直角三角形");
for(int i=1;i<=3;i++){
for(int j=1;j<=i;j++){
System.out.print("*");
}
System.out.println();
}
}
}
2015-08-17
public class HelloWorld {
public static void main(String[] args) {
char today='日';
switch(today){
case '一':
case '三':
case '五':
System.out.println("吃包子");
break;
case '二':
case '四':
case '六':
System.out.println("吃油条");
break;
default:
System.out.println("吃主席套餐");
}
public static void main(String[] args) {
char today='日';
switch(today){
case '一':
case '三':
case '五':
System.out.println("吃包子");
break;
case '二':
case '四':
case '六':
System.out.println("吃油条");
break;
default:
System.out.println("吃主席套餐");
}
2015-08-17
public class HelloWorld {
public static void main(String[] args) {
int score = 90;
String sex = "男";
{
if(score>80){
System.out.println("进入"+sex+"子组决赛");
}else{ System.out.println("淘汰");}
}
}
}
public static void main(String[] args) {
int score = 90;
String sex = "男";
{
if(score>80){
System.out.println("进入"+sex+"子组决赛");
}else{ System.out.println("淘汰");}
}
}
}
2015-08-17
public class HelloWorld {
public static void main(String[] args) {
int age=25;
if(age>60){
System.out.println("老年");
}else if(18=<age<=40){
System.out.println("少年");
}else{
System.out.println("童年");
}
}
}
public static void main(String[] args) {
int age=25;
if(age>60){
System.out.println("老年");
}else if(18=<age<=40){
System.out.println("少年");
}else{
System.out.println("童年");
}
}
}
2015-08-17
用*打印长方形代码好像有问题,下面完整代码
package com.javaprogram;
public class javaprogram {
public static void main(String[] args){
for (int i=1;i<=3;i++){
for (int j=1;j<=8;j++){
System.out.print("*");
} System.out.print("\n");
}System.out.println();
}
}
package com.javaprogram;
public class javaprogram {
public static void main(String[] args){
for (int i=1;i<=3;i++){
for (int j=1;j<=8;j++){
System.out.print("*");
} System.out.print("\n");
}System.out.println();
}
}
2015-08-17
public class Shenweiqi{
public static void main(String[] args){
int sum=0;
for(int i=1;i<=10;i++){
if(i%2!=0){
continue;
}
sum=i+sum;
System.out.println("和为"+sum);
}
}
}
public static void main(String[] args){
int sum=0;
for(int i=1;i<=10;i++){
if(i%2!=0){
continue;
}
sum=i+sum;
System.out.println("和为"+sum);
}
}
}
2015-08-16