Write a java program to print number divisible 3, 5 In this java program, I'm going to print the number which is divisible by 3 , divisible by 5 and divisible by 3 and 5 both: package programlist; public class Numbers { public static void main(String[] args) { for(int i=1; i<=1; i++) { System.out.println("Divisable by 3"); for(int l=1; l<=50; l++) { if(l%3==0) { System.out.println(l); } } System.out.println("Divisable by 5"); for(int j=1; j<=50; j++) { if(j%5==0) { System.out.println(j); } } System.out.println("Divisable by 3 & 5"); for(int k=1; k<=50; k++) { if(k%3==0 && k%5==0) { System.out.println(k); } } } } } OutPut: Divisable by 3 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 Divisable by 5 5 10 15 20 25 30 35 40 45 50 Divisable by 3 & 5 15 30 45
Software Quality Assurance