Basic

Switch Case

Goto

Operators

if Statement

Nested if

While Loop

For Loop

Patterns

Array

2D Array

String Function Example

Pointers

Recursion Function

Structure

Excersises

Others


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 i=1,n,t;
  printf("Enter the limit :");
  scanf("%d",&n);
  printf("Enter the table's number :");
  scanf("%d",&t);
  start:
  printf("\n%d*%d=%d",i,t,i*t);
  i++;
  if(i<=n)
  {
    goto start;
  }
  return 0;
}

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