Write a C program to Generate Multiplication Table

Function Main
    Declare Integer n
    Declare Integer i
    Output "Enter a number: "
    Input n
    For i = 1 to 10
        Output "" & n & "*"  & i  & "=" &n*i
    End
End

#include <stdio.h>
int main() {
  int n, i;
  printf("Enter a number: ");
  scanf("%d", &n);
  for (i = 1; i <= 10; ++i) {
    printf("%d * %d = %d \n", n, i, n * i);
  }
  return 0;
}

Enter a number: 9
9 * 1 = 9
9 * 2 = 18
9 * 3 = 27
9 * 4 = 36
9 * 5 = 45
9 * 6 = 54
9 * 7 = 63
9 * 8 = 72
9 * 9 = 81
9 * 10 = 90

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.