Computer Science, asked by ArpitaSharmaAS, 1 year ago

Write a java program to enter a number and check whether it is a multiple of 2 or multiple of 3 or multiple of 2 and 3 both using if else.
plzz answer it clearly.​

Answers

Answered by Anonymous
4

import java.util.*;

{

public static void main (String args [])

{

Scanner sc=new Scanner (System.in);

System.out.println("enter a number");

int n=sc.nextInt();

if(n%2==0)

{

System.out.println("it is multiple of 2");

}

else if(n%3==0)

{

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

}

else if (n%2==0 && n%3==0)

{

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

}

}

}


Anonymous: welcome
Anonymous: anymore questions??
ArpitaSharmaAS: no if I'll have any then I'll definitely ask to u
Anonymous: ok
ArpitaSharmaAS: plzz answer my one more question
ArpitaSharmaAS: its in my profile
Anonymous: ok
Similar questions