package Important;
public class ChengFa {
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i = 1;i <= 9;i++) {
for(int j = 1;j <= i;j++) {
System.out.print(j+"*"+i+"="+j*i+"\t");
}
System.out.println();
}
}
}
提示: a+b+c=100 只
5a+3b+1/3c=100钱
package Important;
public class ChengFa {
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i = 1;i <= 9;i++) {
for(int j = 1;j <= i;j++) {
System.out.print(j+"*"+i+"="+j*i+"\t");
}
System.out.println();
}
}
}
package Important;
public class MaiGua {
public static void main(String[] args) {
// TODO Auto-generated method stub
int sum = 1020;
int i = 0;
while(sum > 0) {
i++;
sum = sum/2 - 2;
}
System.out.println("卖完这些西瓜需要的天数是:"+i);
}
}
package Important;
public class Monkey {
public static void main(String[] args) {
// TODO Auto-generated method stub
int sum = 1;
for(int i = 1;i <= 9;i++) {
sum = (sum+1)*2;
}
System.out.println("猴子一开始摘桃子数为:"+sum);
}
}
package Important;
public class JiTuTongLong {
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i = 50;i >= 0;i--) {
int j = 50-i;
if(i*4+j*2 == 160) {
System.out.println("兔子有:"+i+"只"+" 鸡有:"+j+"只");
}
}
}
}
package Important;
public class FeiBO {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a = 1;int b = 1;
int sum = 0;
for(int i = 3;i <= 12;i++) {
sum = a + b;
a = b;
b = sum;
}
System.out.println("一年之后兔子数量有:"+sum+"只");
}
}
package Important;
public class SuShu {
public static void main(String[] args) {
// TODO Auto-generated method stub
int flag = 0;
for(int i = 300;i <= 400;i++) {
for(int j = 2;j < i;j++) {
if(i%j == 0) {
flag = 1;
break;
}else
flag = 0;
}
if(flag == 0) {
System.out .print(i+"\t");
}
}
}
}
package Important;
import java.util.Arrays;
import java.util.Scanner;
public class PaiXu {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner reader = new Scanner(System.in);
int [] arr = new int[10];
System.out.println("输入数组:");
for(int j = 0;j < 10;j++) {
arr[j] = reader.nextInt();
}
for(int i = 0;i < 10-1;i++) {
for(int j = 0;j < 10-i-1;j++) {
if(arr[j] > arr[j+1]) {
int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
System.out.println("排序后的数组:");
System.out.print(Arrays.toString(arr));
}
}