java program for printing binary right angled traingle

/*
1
1 0 
1 0 1
1 0 1 0
1 0 1 0 1
*/

import java.io.*;
import java.util.*;

public class Binary_triangle {
public static void main(String[] args) {
       
        int num,row,coloumn;
        System.out.println(“Enter the size of row”);
        Scanner sc=new Scanner(System.in);
        num=sc.nextInt();
        for(row=1;row<num;row++)
        {
            for(coloumn=1;coloumn<=row;coloumn++)
                System.out.print(coloumn % 2+”t”);
                System.out.print(“n”);
       
        }       
    }
   
}

Leave a Comment

Your email address will not be published. Required fields are marked *

To Resolve this issue at just 5$ from ServerExpert

https://serverexpert.io/

For Hosting please visit Hostingwebsite.io

You have Successfully Subscribed!

Open chat