plz guyz tommorw I have test ...
write a program to input a no. and check whether it is a three digit no. divisible by three or not ...
conditional structure ...
Plz help ...
Answers
For Java... class abc { void main(int n) { if (n<=999 || n>=100) &&(n%3==0) { System.out.println(n + " is a three digit number divisible by 3"); } else System.out.println( "Wrong number"); } } Hope it helps :-)
import java.io.*;
class Divisible
{
public static void main()throws IOException
{
DataInputStream di= new DataInputStream(System.in);
int n;
System.out.println("Enter any number " );
n=Integer.parseInt(di.readLine());
if(n>99 && n<1000 && n%3==0)
System.out.println(" Number is divisible by 3=" +n);
else
System.out.println(" Number is not divisible by 3=" +n);
}
}