67 172
Assignments Done
99,3%
Successfully Done
In November 2018

Answer to Question #3529 in Java | JSP | JSF for Y mukundareddy

Question #3529
Test if a number is a multiple of 3, 5 or 7.
Expert's answer
import java.util.Scanner;




public class Main {




public static void main(String[] args) {




int n;

Scanner in = new Scanner(System.in);

System.out.print("Enter a number: ");

n = in.nextInt();

if(n % 3 == 0)

System.out.println(n + " is a multiple of 3");

if(n % 5 == 0)

System.out.println(n + " is a multiple of 5");

if(n % 7 == 0)

System.out.println(n + " is a multiple of 7");

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

System.out.println(n + " is a not multiple of 3, 5 or 7");

}




}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions