mardi 1 décembre 2020

OR operator in if statement JAVA? [closed]

import java.util.Scanner;

Hello i am tring to write the program that calculate numbers between 100 and 200 and prints them if they can be divided by 3 or 4 but not both of them at the same time. And also i am trying to do it as ten numbers in per line but there is a mistake and i can't see it. Compiler gave me an error at if (i % 3 == 0 || i 4 % == 0 ) i don't know why but i can't use OR operator in if statement. Can anyone help me ? (Sorry for my english if it is not good btw)

Scanner input = new Scanner(System.in);
    int countt = 0;
    int counttt = 0;
   
    for (int i = 100; i <= 200; i++){
        
   if (i % 3 == 0 || i 4 % == 0 ){
        
        System.out.println(i);
        countt++;
        if (countt == 10)
            System.out.println(" ");
    }
      
  }
  
  
         
     
    
    
       

}}

Aucun commentaire:

Enregistrer un commentaire