多重for循环

class t6{
	public static void main(String[] args) 
	{
		//五行矩形四列
		
		for(int i=0;i<=5;i++){
			for(int j=0;j<=4;j++)
			{
					System.out.print("*");
			}
		
		}
	
	}
}

//

class t7{
	public static void main(String[] args) 
	{
	//五行五列直角三角形
		for(int i=0;i<=5;i++){
			for(int j=0;j<=5-i;j++)
			{
					System.out.print("*");
			}
		
		}
	}
}

///


```java
class t8{
	public static void main(String[] args) 
	{
		//九九乘法表
		//方法①
		for(int i=1;i<=9;i++)
		{
			for(int j=1;j<=i;j++)
			{
				System.out.print(i+"*"+j+"="+i*j);
			}
				System.out.println();
		}

	

	}
}
/

```java

```java
class t9{
	public static void main(String[] args) 
	{
		//等腰三角形
		for(int i=1;i<=9;i++)
		{
			for(int k=1;k<=9-i,k++)
				{
					System.out.print(" ");
				}
			for(int j=1;j<=2*i-1;j++)
				{
					System.out.print("*");
				}
			
					System.out.println();

		}
	}
}


			

```java
import java.util.Scanner;
class t10{
	public static void main(String[] args) 
	{
		//键盘录入乘法表
		System.out.println("请输入想要计算");
		Scanner sc =new Scanner(System.in);
		int h =sc.nextInt();
		
		//九九乘法表
		for(int i=1;i<=h;i++)
		{
			for(int j=1;j<=i;j++)
			{
				System.out.print(i+"*"+j+"="+i*j);
			}
				System.out.println();
		}
		
	}
}

/

import java.util.Scanner;
class t11{
	public static void main(String[] args) 
	{
		//键盘录入等腰三角形
		Scanner sc =new Scanner(System.in);
		int h=sc.nextInt();
		for(int i=1;i<=h;i++)
		{
			for(int k=1;k<h-i;k++)
			{
				System.out.print(" ");
			}
			for(int j=1;j<=2*i-1;j++)
			{
				System.out.print('*');
			}
		}
			System.out.println();
	}
}

//

class{
	public static void main(String[] args) 
	{
	 	
		//倒直角三角
				for(int i=4;i>=1;i--){
					for(int j=1;j<=2*i-1;j++){
						System.out.print("*");
					}
					System.out.println( );
				}
				
				//正倒三角合起来可以成为菱形(不再写)
                                //倒的等腰三角
				for(int a=4;a>=1;a--) {
					for(int k=1;k<=5-a;k++)
					{
						System.out.print(" ");
					}
					for(int b=1;b<=2*a-1;b++){
						System.out.print("*");
					}
					System.out.println( );
				}
					





	}
}

///

class t13{
	public static void main(String[] args) 
	{
//空心菱形
		for(int i=1;i<=5;i++){
			for(int k=1;k<=5-i;k++){
			
				System.out.print(" ");
			}
			for(int j=1;j<=2*i-1;j++){
					
					//System.out.print('*');
					if(i==0||i==5){
					
							System.out.print("*");
					}else if(j==1||j==2*i-1){
								System.out.print("*");
					}else{
					
								System.out.print(" ");
					}
			}
			System.out.println( );
		}
				

	
	}
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值