文件名称:非常经典的java一道题
文件大小:1KB
文件格式:JAVA
更新时间:2014-01-23 14:20:32
java的编程题
import java.util.Scanner; public class v { /* * Merry Christams!!! */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("请输入要祝福人的名字:"); String name = sc.next(); for (int i = 0; i <= 5; i++) { for (int k = 0; k <= 7 - i; k++) { System.out.print(" "); } for (int z = 1; z <= 2 * i - 1; z++) { System.out.print("*"); } System.out.println(); } for (int i = 3; i <= 7; i++) { for (int k = 0; k <= 7 - i; k++) { System.out.print(" "); } for (int z = 1; z <= 2 * i - 1; z++) { System.out.print("*"); } System.out.println(); } for (int i = 0; i <= 4; i++) { for (int k = 0; k <= 5; k++) { System.out.print(" "); } for (int z = 1; z <= 3; z++) { System.out.print("*"); } System.out.println(); } System.out.println("亲手为你准备棵圣诞树送个你!"); System.out.println("祝福" + name + "圣诞快乐!"); System.out.println(" " + "生蛋快乐!!"); } }