Monday, January 23, 2012

IF-THEN-ELSE statement

IF-THEN-ELSE statement is a decision making statement. This statement can change the the order of program execution. It is used to select a path,  flow in a program based on a condition. Here a Condition is an expression  that either evaluates  to true  or false. The true is representee  by 1 and false is represented by 0. Its Syntax is :
                IF expression THEN Statement
                IF expression THEN line number
                If the expression is true then either the statement at the specified line number or the statement following THEN keyword is executed.

23 comments:

  1. Replies
    1. 10 CLS
      20 INPUT "ENTER NUMBER";A
      30 INPUT "ENTER NUMBER";B
      40 IF A+B= 50 THEN PRINT "OK" ELSE PRINT "NOT OK"
      50 END

      Delete
    2. P8DYZETUTUKCDXRCT7IB

      Delete
  2. 10 input a,b
    20 if a>b then 30 else 40
    30 print "greater number is ";a :end
    40 print "greater number is";b
    50 end

    ReplyDelete
  3. c=2
    print c*c+1
    c=c+2
    if c<9 then goto 20
    print c
    end

    ReplyDelete
  4. how to find that the given three digit number is palindrome

    ReplyDelete
  5. Hi guys i am kinda professional at this stuff
    the school have been forcing me to study it for about 5 years and in the next year the will force me again to study it wish me good luck

    ReplyDelete
  6. 10 cls
    20 A=2
    30 print A
    40 A=A+2
    50 ??????
    60 End
    can anyone plz solve this question

    ReplyDelete
  7. Can you give some examples of GW Basic programs using IF....THEN....ELSE with the question

    ReplyDelete
    Replies
    1. 10 input "first angle"
      20 input "second angle"
      30 let sum=90 then print "complement art" else print "not complementary"
      40 end

      Delete
  8. Question is... Write a program to accept the measure of two angles and check if they are complementary

    ReplyDelete
    Replies
    1. 10cls
      20 input "Enter first angle ";a
      30 input" Enter second angel";b
      40if a+b=90 then? "They are complementary angles " Else? "Not"
      50 end

      Delete
  9. Write a GW-BASIC program to calculate the Area of a square or a rectangle or a triangle. Ask the
    perimeter of these shapes from the user. Also, ask the user to enter her choice of shape.

    can anyone plzz solve this as soon as possible

    ReplyDelete
  10. If we talk about printers first name comes in our head is Brother Printers, for latest and updated Drivers for Brother go to the Following Sites.

    solutions.brother.com/windows
    solutions.brother.com/windows
    solutions.brother.com/windows
    solutions.brother.com/windows

    ReplyDelete