This program prints the multiplication table of a given number in reverse order from the given limit down to 1 using a goto statement. Here's how it works:
Although this program works correctly, it uses a goto statement, which is generally considered to be bad programming practice. Using goto can make the code harder to read and understand, and can lead to subtle bugs and errors. A better approach would be to use a for or while loop to iterate over the values of n, without using goto. This would make the program more readable and easier to maintain.
#include<iostream> using namespace std; int main() { int n,a; cout<<"\nEnter the limit :"; cin>>n; cout<<"\nEnter the table's number:"; cin>>a; start: cout<<"\n"<<n<<"*"<<a<<"="<<n*a; n--; if(n>0) { goto start; } return 0; }To download raw file Click Here
Enter the limit :10 Enter the table's number:2 10*2=20 9*2=18 8*2=16 7*2=14 6*2=12 5*2=10 4*2=8 3*2=6 2*2=4 1*2=2
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions