function solution( c1, c2, c3, c4 ) {

        var min;
        var max;
        var x;

        for( var y = c1; y <= c2; y++ ) {

                for( var z = c3; z <= c4; z++ ) {

                        x = y % z;

                        if ( !min ) {
                                min = x;
                        }

                        if ( !max ) {
                                max = x;
                        }

                        if ( x <= min ) {
                                min = x;
                        }

                        if ( x >= max ) {
                                max = x;
                        }
                }

        }

        console.log( 'min: ', min, 'max: ', max );

}

On Thursday, June 25, 2015 at 11:23:19 AM UTC+8, sagar wrote:
>
> You are given a range of modulo operands and find the range of modulo 
> result.
>
> Expression :- *x = y % z*
>
> where range of y is [ c1, c2 ] 
> c1, c2 are real numbers ( can be +ve or -ve ) and  c2 >c1
>
> where range of z is [c3,c4]
>  c3, c4 are real numbers ( can be +ve or -ve ) and  c3 >c4
>
> Range of x is [c5,c6]
>
> Input: User will input constant numbers( +ve or -ve ) corresponding to 
> c1,c2,c3,c4.
>
> Output : c5 and c6.
>
> Write an algorithm for it .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].

Reply via email to