Thursday, August 13, 2020

                                  ALGORITHM

                           -----------------------------

 4.WRITE AN ALGORITHM TO INPUT 2 NUMBERS AND DISPLAY THE LARGEST EVEN NUMBER.


START

STEP 1: DECLARE THE VARIABLE X,Y AS INTEGER.

STEP2: INPUT THE VALUE OF X AND Y

STEP 3: IF (X% 2=0 AND Y%2=0 AND X=Y ) THEN  PRINT "BOTH THE NUMBERS ARE EVEN AND EQUAL "('%' IS USED TO RETURN THE REMAINDER IN CASE OF DIVISION), GO TO END

STEP 4: IF (X%2=0 AND X>Y) THEN PRINT X,"IS LARGEST EVEN"

STEP 5 : IF (Y%2=0 AND Y>X ) THEN PRINT Y,"IS LARGEST EVEN"


END



No comments:

Post a Comment

  3.WAP IN JAVA TO INPUT THREE NUMBERS AND COUNT HOW MANY OF THEM ARE EVEN .   import java.util.*; class Prog {   public static ...