#So after updating all the stuff the bluej's terminal windows keeps adding new line when entering te

16 messages · Page 1 of 1 (latest)

ashen rain
#
import java.util.*;
public class OctalNumber
{
    public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter number of rows: ");
        int M = sc.nextInt();
        System.out.print("\nEnter number of columns: ");
        int N = sc.nextInt();

        int A[][];
        // Checking the condition given
        if ((M>0 && M<10) && (N>2 && N<6)) {
            A = new int[M][N];
            System.out.println("Enter Values");
            for (int i = 0; i < M; i++) 
            {
                for (int j = 0; j < N; j++)
                {
                    do {
                        if (A[i][j] < 0 || A[i][j] > 7)
                            System.out.println("Valid range to enter a number is 0-7.");
                        A[i][j] = sc.nextInt();
                        System.out.print(",\t");
                    } while (A[i][j] < 0 || A[i][j] > 7);
                }
                System.out.println();
            }
            for (int i =0; i<M; i++)
            {
                for (int j=0; j<N; j++)
                    System.out.print(A[i][j] + ", ");
                System.out.println();
            }
        }
        else {
            System.out.println("Invalid Input");
        }
    }
}```
astral jewelBOT
#

This post has been reserved for your question.

Hey @ashen rain! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

ashen rain
#

Yah I know this to some people will seem as a dumb question, cuz when entering the cursor will and should go to the next line. and yah I agree but in my case i don't wanna go on next line is there a way to just revert the cursor back to its position so that it will look nice and elegant

#

or a way to just tweak the settings somewhere in the compiler

ashen rain
lean pecan
#

you can use control codes but that's not a great bet and it kinda would be a pain

#

you'd have to align the columns properly yourself and not all terminals support them

ashen rain
#

Conclusion: Not every update is beneficiary ;)

lean pecan
#

you could instead of have 1 2 3 4 5 6 instead of submitting each separately

ashen rain
#

Hm let me try

#

It works

#

Learnt something new

#

I am going to close the post
Thanks @lean pecan