Print the numbers that are divisible by a given no.

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
    int i, n, d;
    clrscr();
    printf("Enter the limit : ");
    scanf("%d", &amp;n);
    printf("\nEnter the number : ");
    scanf("%d", &amp;d);
    printf("\nThe numbers divisible by %d are :\n\n", d);
    for(i = 1 ; i <= n ; i++)
    if(i % d == 0)
    printf("%d\t", i);
    getch();
}

Output:

Enter the limit : 15
Enter the number : 3
The numbers divisible by 3 are :
3 6 9 12 15