Search This Blog

Friday, 21 August 2020

Break and continue statement

 #include<iostream>

using namespace std;

int main()

{

int n;

while(1)

{

cout<<"Enter the number for know it's square :";

cin>>n;

cout<<"\nPress 0 to exit the loop:";

if(n==0)

{

cout<<"\n\nProgram is end.\n .............THANK YOU..........";

break ;

}

else if(n>=1000)

{

cout<<"\nYour entered number is greater than 1000,\n\nTry again: ";

continue ;


}

cout<<"\n\nSquare of "<<n<<ends<< "is:"<<n*n<<endl;

}

return 0;

}


No comments:

Post a Comment

Search This Blog

Contact Form

Name

Email *

Message *

Popular Posts