**Program to Print Multiples of 5 in C**

In this post, I am going to explain to you how to write a c program to print multiples of 5 using do while loop, for loop and while loop. We know, multiples of 5 are 5, 10, 15, 20 and so on. In other words, we have to print table 5. But, how many multiples do we have to print? We will ask the user to enter the range to display multiples of 5.

The main goal of this post is to write a c program to print multiples of 5 using only do while loop. So, we must know, how to use do while loop in c programming.

In the last part of this article, there is a general c program to find a multiples of a number.

Also read : C Program to Find the Sum of Cubes of Elements in an Array

Let’s see the expected output.

```
Enter the range to print multiples of 5
11
52
Multiples of 5 in 11 and 52 are
15 20 25 30 35 40 45 50
```

As you can see above output, we are printing multiples of 5 in the range 11 and 52. Now, see the actual program for this.

**In the same article, I have also written a c program to print multiples of 15 within a given range.**

**C Program to Print Multiples of 5 using do while loop**

```
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,fnum,lnum;
printf("Enter the range to print multiples of 5\n");
scanf("%d%d",&fnum,&lnum);
i=fnum;
do
{
if((i%5)==0)
{
printf("%d ",i);
}
i++;
}
while(i<=lnum);
return 0;
}
```

In the above program, we are reading the two values of from the user. In other words, we are reading the range to print multiples of 5. First number represent the first number and the second number represent the last number in the range.

Also read: Switch Case in C Program to Calculate Area of Circle and Triangle

We are also using modulus operator (%). This operator returns remainder after division. Why we need to use this operator? We have to print multiples of 5 that means we need to print those numbers which are divisible by 5. In the do while loop, we have used if-else statement and in this if statement, we are using this modulus operator. When any number returns 0 after dividing it by 5, then we can say, that number is multiple of 5.

I hope you like this program. We can write the same program using the **for loop** and **while loop**.

**Print Multiples of 5 using for loop**

```
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,fnum,lnum;
printf("Enter the range to print multiples of 5\n");
scanf("%d%d",&fnum,&lnum);
for(i=fnum;i<=lnum;i++)
{
if((i%5)==0)
{
printf("%d ",i);
}
}
return 0;
}
```

**Print Multiples of 5 using while loop**

```
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,fnum,lnum;
printf("Enter the range to print multiples of 5\n");
scanf("%d%d",&fnum,&lnum);
i=fnum;
while(i<=lnum)
{
if((i%5)==0)
{
printf("%d ",i);
}
i++;
}
return 0;
}
```

Now, we will take one more example. But this time, we will write c program to find multiples of another number.

**C program to print multiples of 15 from m to n**

In this program, m and n mean range of multiples of 15. This program is the same as the above programs. The only difference is, we will have to take 15 instead of 5.

```
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,m,n;
printf("Enter the range to print multiples of 15\n");
scanf("%d%d",&m,&n);
i=m;
while(i<=n)
{
if((i%15)==0)
{
printf("%d ",i);
}
i++;
}
return 0;
}
```

**Output**

```
Enter the range to print multiples of 15
100
200
Multiples of 15 in 10 and 200 are
105 120 135 150 165 180 195
```

**C Program to Find a Multiples of a Number**

This is a general c program. By using this program, you can find multiples of any number within a given range.

```
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,m,n,num;
printf("Enter a number to find multiples\n");
scanf("%d",&num);
printf("Enter the range to print multiples of %d\n",num);
scanf("%d%d",&m,&n);
i=m;
printf("Multiples of 5 are ");
while(i<=n)
{
if((i%num)==0)
{
printf("%d ",i);
}
i++;
}
return 0;
}
```

**Output**

```
Enter a number to find multiples
5
Enter the range to print multiples of 5
20
50
Multiples of 5 are 20 25 30 35 40 45 50
```

I hope you have understood this program. If you have any difficulty, you can contact. I will be happy to solve your difficulty.

**FAQs**

**How to check the no of multiples of 3 in distinct range in c program?**

#include <stdio.h>

#include <stdlib.h>

int main()

{

int i, m, n;

printf(“Enter the range to print multiples of 3\n”);

scanf(“%d%d”,&m,&n);

i=m;

while(i<=n)

{

if((i%3)==0)

{

printf(“%d “,i);

}

i++;

}

return 0;

}

**Write a c program to print the first 10 multiples of 5 using while loop.**

**Program 1**#include <stdio.h>

#include <stdlib.h>

int main()

{

int i;

printf(“First 10 multiples of 5 are\n”);

i=5;

while(i<=50)

{

if((i%5)==0)

{

printf(“%d “,i);

}

i++;

}

return 0;

}

**Program 2**

#include <stdio.h>

#include <stdlib.h>

int main()

{

int i;

printf(“First 10 multiples of 5 are\n”);

i=5;

while(i<=50)

{

printf(“%d “,i);

}

i=i+5;

return 0;

}