Printing a Multiplication Table Using GOTO Statement
Program to print a multiplication table using goto statement.
Example : pgm.c
#include<stdio.h> int main(){ int t,n,i=1; printf("\nEnter the Limit : "); scanf("%d",&n); printf("\nEnter the Table : "); scanf("%d",&t); lable: printf("\n%d*%d=%d",i,t,(i*t)); i++; if(i<=n){ goto lable; } }
Output:
Enter the Limit : 10
Enter the Table : 5
1*5=5
2*5=10
3*5=15
4*5=20
5*5=25
6*5=30
7*5=35
8*5=40
9*5=45
10*5=50
Enter the Table : 5
1*5=5
2*5=10
3*5=15
4*5=20
5*5=25
6*5=30
7*5=35
8*5=40
9*5=45
10*5=50