1 Answer - Sort by: Date | Rating
SYNTAX for nested if:
IF (logical-expression) THEN
statements
IF (logical-expression) THEN
statements
ELSE
statements
END IF
statements
ELSE
statements
IF (logical-expression) THEN
statements
END IF
statements
END IF
typical example can be
Suppose we need a program segment to read a number x and display its sign.More precisely, if x is positive,
+ is displayed; if x is negative, - is displayed; otherwise, a 0 is displayed.
With an IF-THEN-ELSE-END IF statement,we have a two-way decision (i.e., true or false)
for this code will look as
IF (x > 0) THEN
WRITE(*,*) '+'
ELSE
IF (x < 0) THEN
WRITE(*,*) '-'
ELSE
WRITE(*,*) '0'
END IF
END IF
IF (logical-expression) THEN
statements
IF (logical-expression) THEN
statements
ELSE
statements
END IF
statements
ELSE
statements
IF (logical-expression) THEN
statements
END IF
statements
END IF
typical example can be
Suppose we need a program segment to read a number x and display its sign.More precisely, if x is positive,
+ is displayed; if x is negative, - is displayed; otherwise, a 0 is displayed.
With an IF-THEN-ELSE-END IF statement,we have a two-way decision (i.e., true or false)
for this code will look as
IF (x > 0) THEN
WRITE(*,*) '+'
ELSE
IF (x < 0) THEN
WRITE(*,*) '-'
ELSE
WRITE(*,*) '0'
END IF
END IF
0
0
- How To Put Sound Back On My Computer I Shut It Off By Mistake?
- How Do I Put The Sound Back Onn My Computer?
- What Is The Best Computer?
- Does The Acer Aspire 5534 Series Have A Web Cam?
- What Cind Of Devices Did He News?
- What Is The Difference Between A Hard Drive And Ram?
- When I Turn On My Computer On My Monitor Shows The Start Up But Then It Goes Into Power Save Mode Please Help?
- If A Filter Produces 4.1 DB Of Loss And The Input Power Is 21dBm, What Is The Output Power In Watts?
- What Does B (m) Mean In Boot Sizes?
- What Is M2G Devices?
- Where Do I Find The Id Number For The Mother Board Of My Dell D610?
- Does The Iphone 3g Charger Case For The Power Mat Work For The Iphone 3gs?
- Where Is The Wireless Switch In My Compaq Laptop?
- What Does A Laptop Do?
- Can You Tell Me Interesting Super Computer Facts?
- How To Enlarge Print Suze?
- How Much Is A Al Toon Worth1992?
- My Macs Not Loading Can I Do Anything I Have Tried Waiting Its Just Not Going Though Any Help?
- Will 2.19 GHz Run Crysis?
- My P.c. Doesn't Show A Login Screen It Just Log In. What Should I Do To Fix It?
- How To Use The Copier And Scanner?
- How To Operate 3g On Dell Inspiron 1545?
- How Can I Put Sound On My Acer Laptop?
- What Does Integrated Graphics Card Mean?
- Almost The Programs On My CP Pictures Suddenly Are The Ablobe Reader ..........when I Try To Open Them It Says The Program Can't Be Opened With Ablobe Reader.................Help Me PLEASE................What Can I Do? Please Help!
- Can I Define Nested Interface?
- What Is Basic Difference Between If And Nested If Loops?
- Can You Explain Breathing Mechanisms With The Help Of Examples?
- What Are The Phospholipids? Explain The Structure Of Phospholipids And Some Examples?
- Could You Explain The Term Mutations With The Help Of Examples?
- Can You Explain Opportunity Cost With Examples?
- Can You Explain Market Economics With Examples?
- Can You Explain Market Economies With Examples?

New Comment - Comments are editable for 5 min.