This program prints all the numbers between a given starting and ending value using a goto statement. Here's how the program works:
While this program works correctly, using a goto statement is generally not considered good programming practice because it can make the code difficult to read and maintain. A better alternative would be to use a for or while loop to print the numbers.
#include<iostream> using namespace std; int main() { int i,n; cout<<"Enter the number starting number : "; cin>>i; cout<<"Enter the number ending number : "; cin>>n; start: cout<<"\n"<<i; i++; if(i<=n) { goto start; } return 0; }To download raw file Click Here
Enter the number starting number : 5 Enter the number ending number : 10 5 6 7 8 9 10
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions