Posts

Showing posts from October 8, 2017

IF THAN ELSE STATEMENT

Image
IF THAN ELSE STATEMENT: The general form of  this statement is as follows: when the above if statement is executed the condition expression is evaluated. if the condition is true then the block of statement is follow else mean if the condition is not true then other block of statement follows PROGRAM #1 OUTPUT: In this program when the condition n>450 is true then the statement that is written inside the bracket after are displayed .If condition n>450 is not satisfied then the statement after else is displayed. PROGRAM: OUTPUT

NESTED LOOP

Image
Nested loop mean loop with in the loop. It is the combination of two loop .When one loop finished which is inside the loop then the next loop (first loop) is executed.The Syntax of  this loop is as follows. PROGRAM#1 Firstly the loop that is present inside the first loop is executed then when the condition prove then control move towards first loop OUTPUT PROGRAM OUTPUT

DO WHILE LOOPING

Image
DO WHILE LOOP It is the frequently required that you want the loop to execute at least once as you do with menus and many other application in such condition you should begin with a statement that make a condition true it becomes tedious initializing the variable before each loop. C also provides a type of loop that checks the condition after executing the statements in the loop so you can sure it execute at least once.This sort of loop takes a form that is easy to understand    EXAMPLE: In the following program we print the alphabets from A to Z by using do while loop. As A to Z is a alphabet so char is used for supposition instead of int.The ch='A' show that it is input value that is shown in the loop .the ch=ch+1 show that it is an increment and after loop while statement is used with condition that condition is a ending point the program is shown as follows PROGRAM: OUTPUT: