DO NOT MISS

Ads

Friday 5 August 2016

C-Programs Using Continue statement

It is a keyword which is used to skip the statements in a loop.
(or)
This statement is used to continue the execution of loop. It is used with if condition with in the loop.

Syntax:-

Conditional code
     {
          if(cond)
              {
                  continue;
              }
        statement;
      }

Flow chart:-
Programs:

* Write a program to use continue statement & skip the one number.


#include<stdio.h> 

#include<conio.h> 

void main() 

    { 

             int i; 
             clrscr(); 

             for(i=1;i<=10;i++) 

                { 

                      if(i==3) 
                      continue;
                      printf("%d\t",i); 

               } 

             getch(); 

    }

Output:-


* Write a program to use continue statement & skip the two numbers.


#include<stdio.h> 

#include<conio.h> 

void main() 

       { 

                 int i; 
                 clrscr(); 

                 for(i=1;i<=10;i++) 

                       { 

                             if(i==5||i==8) 
                             continue; 
                             printf("%d\t",i); 

                       } 

                 getch(); 

       }

Output:-


__________________________________________________
>> Back to Jumping Statements
___________________________________________________
___________________________________________________
_____________________________________________________
___________________________________________________


Greataims

 
Copyright © 2016 Computersadda. Designed by @ Computersadda Team - Published By Greataims