Q-Basic – WAP to determine the largest number among three given numbers

    WAP to determine the largest number among three given numbers.

This program in Q-Basic finds the largest among three numbers stored in variables A, B, C. It shows the implementation of IF..ELSE clause in Q-Basic Programming. To find largest among three different numbers, this program first compares A with B. If A is greater than B then it again compares A with C. Now if the result is true then prints “A IS GREATER” else prints “C IS GREATER”. When A was lesser than B then, B is compared with C and if results comes true then prints “B IS GREATER” else “C IS GREATER”.

CLS

INPUT “ENTER THREE NUMBERS”; A, B, C

IF A>B THEN

     IF A>C THEN

          PRINT “A IS GREATER”

     ELSE

          PRINT “C IS GREATER”

ELSE

     IF B>C THEN

          PRINT “B IS GREATER”

     ELSE

          PRINT “C IS GREATER”

     END IF

END IF

END

 
For more similiar Programms Click Here

Comments are closed.