Pages

Wednesday, 21 February 2018

Example of goto statement in C++ Programming Language

Example of goto statement in C++ Programming Language
#include <iostream>
using namespace std;
int main(){
   int num; cout<<"Enter a number: "; cin>>num;
   if (num % 2==0){
      goto print;
   }
   else {
      cout<<"Odd Number";
   }

   print:
   cout<<"Even Number";
   return 0;

}