Search This Blog

Saturday, 27 October 2012

Write a program to continue statement

#include<iostream.h>
void main()
{
int i;
cout<<"The following number are divisible by 5";
for(i=1;i<=25;i++)
{
if(i%5!=0)
continue;
cout<<i<<"\t";
}
}

output:
5   10   15   20   25

using statement is continue statement:

When the continue statement executes, it skips the remaining statements in the loop and continue the next iteration.

The general form of continue is:
continue;

No comments:

Post a Comment