plain/semester_1/erg6_ask3/Erg6_Ask3.java
public static void main(String[] args) {
        int n, npar, i;
        boolean protos=true;
        
        do { System.out.print("enter a number between 0 and 10: ");
            n = scannerUserInput.getInteger();
        }
        while ( n < 0 || n > 10 );
        
        npar = 1;
        
        for ( i=2; i<=n; i++ ) {
            npar = npar*i;
        }
        
        System.out.println("npar's value is " + npar);
        
        do { System.out.print("enter a number between 2 and 100: ");
            n = scannerUserInput.getInteger();
        }
        while ( n < 2 || n > 100 );
        
         for( i=2; (n/2)>i; i++ ){
                if( (n%i) == 0 ){
                        protos = false;
                }
        }
        
        if ( protos==true ) {
                System.out.println("n is a prime number");
        }
        else {
                System.out.println("n is not a prime number");
        }
        
        System.out.println("the value of the variable protos is: " + protos);
    }
/**
     * @param args the command line arguments
     */
@param args the command line arguments
@param args the command line arguments
public static void main(String[] args) {
        int n, npar, i;
        boolean protos=true;
        do { System.out.print("enter a number between 0 and 10: ");
            n = scannerUserInput.getInteger();
        }
        while ( n < 0 || n > 10 );
        npar = 1;
        for ( i=2; i<=n; i++ ) {
            npar = npar*i;
        }
        System.out.println("npar's value is " + npar);
        do { System.out.print("enter a number between 2 and 100: ");
            n = scannerUserInput.getInteger();
        }
        while ( n < 2 || n > 100 );
         for( i=2; (n/2)>i; i++ ){
                if( (n%i) == 0 ){
                        protos = false;
                }
        }
        if ( protos==true ) {
                System.out.println("n is a prime number");
        }
        else {
                System.out.println("n is not a prime number");
        }
        System.out.println("the value of the variable protos is: " + protos);
    }
public static void main ( String [ ] args ) { int n , npar , i ; boolean protos = true ; do { System . out . print ( "enter a number between 0 and 10: " ) ; n = scannerUserInput . getInteger ( ) ; } while ( n < 0 || n > 10 ) ; npar = 1 ; for ( i = 2 ; i <= n ; i ++ ) { npar = npar * i ; } System . out . println ( "npar's value is " + npar ) ; do { System . out . print ( "enter a number between 2 and 100: " ) ; n = scannerUserInput . getInteger ( ) ; } while ( n < 2 || n > 100 ) ; for ( i = 2 ; ( n / 2 ) > i ; i ++ ) { if ( ( n % i ) == 0 ) { protos = false ; } } if ( protos == true ) { System . out . println ( "n is a prime number" ) ; } else { System . out . println ( "n is not a prime number" ) ; } System . out . println ( "the value of the variable protos is: " + protos ) ; }
@param args the command line arguments
@param args the command line arguments