Skip to main content

Posts

Showing posts with the label Loops and Statements
To Get All Information of Sarkari Jobs | Results | Admit Card | And courses ,Internships then CLICK HERE

Continue Statement-:

continue is a keyword.The continue statement can only be use within loop.On execution it transfers the control to the beginning of the loop, Thus ignoring the execution of all other statement written below it within the loop. A continue statement should always be dependent upon the condition. Syntax of continue statement in for loop -: for( _ ; _ ;_ )     {     _            _        if(condition)             continue;        else               _               _         } Example  of continue statement in for loop   -: ads #include<stdio.h> #include<conio.h> main() { int i=1;    for(i=1;i<=5;i++)  { if(i==3)     continue;      else      printf(" %d \n ",i);   } ...

Break Statement-:

1- break is a keyword. 2- The break statement is used within a loop or switch statement on execution,it transfer the control outside the loop or switch statement within which it is enclosed. 3- The break statement should always be dependent upon a condition. ads Syntax of break statement in for loop -: for( _ ; _ ;_ )     {     _            _        if(condition)             break;        else               _               _        } Example  of break statement in for loop   -: #include<stdio.h> #include<conio.h> main() { int i=1;    for(i=1;i<=5;i++) { if(i==3)    break;    else    printf(" %d \n ",i);  }    getch();   }     Output-:  1 ...

do-while loop-:

do-while is a condition control loop.The do-while loop is used to carry out looping operation,in which a statement or group of statements is/are executed repetitively until some logical condition has been satisfied. do-while is also called "exit-control loop" ,because in do-while loop first the statement get executed and then the condition is checked,hence the do-while always execute at least one's. In the do-while loop, there must be at least one such statement within the body of loop which changes the looping condition,during the execution of loop otherwise an infinite loop may occur. ads Syntax -: do     statement;     while(condition); or, do    {statement-1;      statement-2;      -      -      statement-n;      }while(condition); Example -: Write a program to find sum of series of terms: 2+4+6+8+ - - -n #include<stdio.h> #include<conio.h...

While Loop-:

While loop is a condition control loop.The while loop is used to carry out looping operation.In while loop,a statement or a group of statements is/are executed repetitively until some condition has been satisfied.There must be at least one such statement within the body of loop which changes the looping condition during the execution of loop,otherwise an infinite loop may occur.While loop is also called "Entry-Control Loop" because in while loop first the condition is checked and then the statement  get executed. ads Syntax -: while(condition)     statement; or, while(condition) {statement-1;  statement-2;  -  -  statement-n; } Example -:                ads Write a program to find sum of series of terms: 1+3+5+ - - -n. #include<stdio.h> #include<conio.h> main() { int term=0,i=1,s=0;    printf("Enter the number of term");    scanf("%d ",&term); ...

for loop-:

for loop is a counter controlled loop,perhaps the most commonly used looping statement in C programming. It is used to repeatedly execute either a single or a group of statement for a finite number of times. Syntax -: for( I nitialization ;Testing; I ncrement/Decrement )                                                                       ads Initialization-: This expression is used to initialize same parameter [called an index],that control the looping action. Testing Expression-: It represent a condition that must be TRUE for the loop to continue its execution. I ncrement/Decrement Expression-: It is a unary expression or an assignment expression.It increment or decrement the index so that the loop continue. Example -: #include<stdio.h> #include<conio.h> main() { int i=0...

Loops/iteration-:

Loops or iteration are mostly use in C programs. sometimes a program may require that a group of instruction executed repeatedly either for a finite number of times or until some logical condition has been satisfied,this is known as looping. Loops are used to repeat the execution of  a statement or a set of statement,depending on the value of  an integer expression. There are two categories of Loops-: 1- Counter Controlled Loop -:   These are the loops in which the number of repetition are finitely fixed. for loop CLICK HERE 2- Condition Controlled Loop -: These are the loops in which number of repetition are not fixed. ads while loop   CLICK HERE do-while loop     CLICK HERE ads Watch The Video Below 

Download The Book "Let Us C" By Yashavant P.Kanetkar,Click The Below Button

-->Email Subscription

Enter Your Email Address:-

Delivered by FeedBurner

Copyright © 2020 TechProgramiz|All Right Reserved|Made By-: Sudarshan Pandey