Quick actions

cmd+k|ctrl+k

Navigation

Languages

2518JavaDebug

Snippet info

Language

Java

Visibility

public

Author

mhcrnl

Created

2018-11-14T10:23:12Z

Updated

2018-11-14T11:26:07Z


class Impartire{
    int intDiv(int m, int n){
        int x=m;
        int y =0;
        
        while(x>=n){
            x=x-n;
            y=y+1;
        }
       return y; 
    }
    
    int intDiv(int m, int n, boolean tm){
        
        int x=m;
        int y=0;
        
        if (tm){
            System.out.println("x: "+m+" n: "+n);
        }
        
        while (x>=n ){
            x=x-n;
            y=y+1;
            
            if(tm){
                System.out.println("x: "+x+" n: "+n+" y: "+y);
            }
        }
        
        return y;
    }
}

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World!");
        
        Impartire imp= new Impartire ();
        System.out.println( imp.intDiv(90,5));
        System.out.println (imp.intDiv(56,6,true));
        System.out.println (imp.intDiv (34, 5, false ));
    }
}
INFO