write a Java program
Attachments:
Answers
Answered by
90
import java. util.*;
class number
{
public static void main(String args[] )
{
Scanner sc= new Scanner (System. in);
System. out. print("Enter a number: ");
int n= sc. nextint();
if (n%3==0&&n%5==0)
System. out. printIn("Number is divisible by 3 and 5.")
else if (n%3==0&&n%5!==0)
System. out. printIn("Number is divisible by 3 and 5.")
else if (n%3==0&&n%5!==0)
System. out. printIn("Number is divisible by 3 and 5.")
else if (n%3==0&&n%5!==0)
Answered by
14
Required Program :
import.java.util.*;
public class number
{
public static void main (String args[])
{
Scanner in = new Scanner(System.in);
int a,b,c,avg;
System.out.println("Enter a number");
a = in.nextInt();
b = a/10;
c = a%10;
avg = (b+c)/2;
System.out.println("Average of the digits ="+avg);
}
}
_______________________
Similar questions