Wednesday, September 14, 2016

Use of continue statement in C program.



//To demonstrate use of continue statement in C program.

#include<stdio.h>
void main()
{
  int rollno, i;
  for(i=0; i<5; i++)
  {
      printf("Enter your number:");
      scanf("%d", &rollno);               
      if ( rollno == 10)
      {
          printf("Pay your fees.\n");
          continue;
      }
      printf("%d is eligible...Give your exam.\n", rollno);
  }
  printf("Good bye");
}


Output of the Program:

Enter your number:1
1 is eligible...Give your exam.
Enter your number:2
2 is eligible...Give your exam.
Enter your number:10
Pay your fees.
Enter your number:4
4 is eligible...Give your exam.
Enter your number:5
5 is eligible...Give your exam.
Good bye


No comments:

Post a Comment