Pages

Sunday, 3 February 2019

PROGRAM TO ILLUSTRATE CONTINUE AND BREAK STATEMENTS

CASE CONTROL STRUCTURES:

1. continue statement program:

// prg to illustrate continue statement
#include<stdio.h>
void main()
{
 int i=1,n,s;
 printf("enter n value:");
 scanf("%d",&n);
 printf("enter skip value:");
 scanf("%d",&s);
 for( i=1; i <= n ; i++)
  {
   if (i == s)
   {
   printf("\nSkipping %d from display using continue statement \n",i);
   continue;
   }
   printf("%d\n",i);
 }
}  







output:


2. break statement program:

// prg to illustrate break statement
#include<stdio.h>
void main()
{
 int i=1,n,s;
 printf("enter n value:");
 scanf("%d",&n);
 printf("enter skip value:");
 scanf("%d",&s);
 for( i=1; i <= n ; i++)
  {
   if (i == s)
   {
   printf("\nSkipping %d from display using continue statement \n",i);
   break;
   }
   printf("%d\n",i);
 }
}  
output:

No comments:

Post a Comment

Programs in turboc3 : Files

File Handling in C File Handling concept in C language is used for store a data permanently in computer. Using this concept we can store our...