Computer Science, asked by shikhamondal71, 9 months ago

Write a program that inputs a number & tests if the given number is a multiple of both 3&5

Answers

Answered by swastikachoudhury7
25

class prg

{

void display (int n)

{

if(n%3==0 && n%5==0)

{

System.out.println(" it is a multiple of 3 and 5");

}

else

{

System.out.println("it is not a multiple of 3 and 5);

}

}

}

Answered by mathurniharika66
3

Answer:

Explanation:Input: n = 6

Output: 3

There are three multiples of 3 and/or 5 in {1, 2, 3, 4, 5, 6}

Input: n = 16

Output: 7

There are two multiples of 7 and/or 5 in {1, 2, .. 16}

The multiples are 3, 5, 6, 9, 10, 12, 15

Similar questions