mercredi 2 juin 2021

how do i get this program to stop printing 3 times the same number

//My code keep outputing everything 3 times instead of 1 my goal is to get 3 number to print on the same line then move the only problem is instead of printing 3 different variable its printing 3 times the same 1 and moving to next line

int counter=0;
    do {    
    for(int c= a; c <= b; c++){
        if (c % 3 ==0);
        System.out.print("");
        counter++;
        int counte = 0;
    
        for (int i = 0 ; i <3 ; i++) {
            for (int j = 0; j < 3 ; j++) {
                System.out.print (c);
                System.out.print (" "); // I think it is best to have spaces between the numbers
              
            }
            //after printing 10 numbers, go to a new                                   line
             System.out.println ();
           }
        
            
          }
    

          }while(counter<3);

Aucun commentaire:

Enregistrer un commentaire