Program to print table of a number having start limit and end limit using for loop

Write a program to print a table of a number having start limit and end limit using for loop.

C Program

#include <stdio.h>
int main()
{
    int num;
    int startlimitendlimiti;
    printf("Enter a number : ");
    scanf("%d", &num);
    printf("Enter start limit : ");
    scanf("%d", &startlimit);
    printf("Enter end limit : ");
    scanf("%d", &endlimit);
    for (i = startlimiti <= endlimiti++)
    {
        printf("%d X %d = %d\n"numii * num);
    }
    return 0;
}

Input:

Enter a number : 5
Enter start limit : 1
Enter end limit : 10

Output:

5 X 1 = 5
5 X 2 = 10
5 X 3 = 15
5 X 4 = 20
5 X 5 = 25
5 X 6 = 30
5 X 7 = 35
5 X 8 = 40
5 X 9 = 45
5 X 10 = 50


No comments:

Post a Comment