Computer Science, asked by Gauravphulwani, 11 months ago

Java program questions
Write a program to check whether an int type number (taken as input) is a multiple of 5 or not.


Write a program to check whether an int type number (taken as input) is a 2-digit number or not. ​

Answers

Answered by irakhedkar
1

1.

import java.util.*;

class program_1{

public static void main(String args[]){

Scanner in = new Scanner(System.in);

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

int n = in.nextInt();

if(n%5 == 0){

System.out.println("The input is a multiple of '5'");

}

else{

System.out.println("The input is not a multiple of '5'");

}

}

}

2.

import java.util.*;

class program_1{

public static void main(String args[]){

Scanner in = new Scanner(System.in);

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

int n = in.nextInt();

if(n%2 == 0){

System.out.println("The input is a multiple of '2'");

}

else{

System.out.println("The input is not a multiple of '2'");

}

}

}

Hope this helps,

ira.

Answered by soaujanyadas12345
2

Answer:

import java.util.*;

class Q

{

static void main()

{

int n;

Scanner sc=new Scanner(System.in);

System.out.println(“Enter an integer:”);

n=sc.nextInt();

if(n%5==0)

System.out.println(“Multiple of 5”);

else

System.out.println(“Not a multiple of 5”);

}

}

sedond no

import java.util.*;

class Q

Computer Applications – IX (ICSE Course) Answers 94

{

static void main()

{

int n;

Scanner sc=new Scanner(System.in);

System.out.println(“Enter an integer:”);

n=sc.nextInt();

if(n>=10 && n<=99 || n>=-99 && n<=-10)

System.out.println(“2-digit number”);

else

System.out.println(“Not a 2-digit number”);

}

}

Explanation:

Similar questions