Professional Documents
Culture Documents
1. Write a program that will read a number from the user. The number will be tested and:
If (num % 2== 0)
elseIf
(num % 3== 0)
elseIf
(num % 5==0)
else
}
}
If (num % 2== 0)
elseIf
(num % 3== 0)
elseIf
(num % 5==0)
else
}
//Java progam to test whether n is divisible by 2,3 and 5
If (num % 2== 0)
elseIf
(num % 3== 0)
elseIf
(num % 5==0)
else
}
import java.util.Scanner;
If (num % 2== 0)
else if
(num % 3== 0)
else if
(num % 5==0)
else
}
package mycompany.assignmentjava;
import java.util.Scanner;
if (num % 2== 0)
if
(num % 3== 0)
if
(num % 5==0)
else
}
package mycompany.assignmentjava;
import java.util.Scanner;
if (num % 2== 0)
if
(num % 3== 0)
if
(num % 5==0)
else
}
import java.util.Scanner;
public class divisibilityTest{
public static void main(String[] args){ //after main there is no semi-
colon