write a program to print the first 10 multiples of 3
Answers
Answered by
6
Answer:
# function to print the first m multiple
# of a number n without using loop.
def multiple(m, n):
# inserts all elements from n to
# (m * n)+1 incremented by n.
a = range(n, (m * n)+1, n)
print(*a)
# driver code
m = 4
n = 3
multiple(m, n)
Explanation:
Answered by
13
import java.util.*;
public class Multiple
{
public static void main(String args[])
{
//in the program there is no necessary of taking input so we should not use the scanner class
int i;
//we should give priority to the for loop as we have to run the program several times during this process
for(i=1; i,=10; i++)
{
do
{
System.out.println(3*i);
i=i+1
}
while(i<=10)
}
}
}
Similar questions