Computer Science, asked by sana6077, 1 year ago

write a program to display all the numbers between hundred and 200 which don't contain zeros at any position​

Answers

Answered by Lazarus
17

Answer:

PROGRAM ON BLUEJ JAVA environment:-

import java.util.*; // java utility package//

class position // class name

{

public static void main()

{

Scanner Sc=new Scanner(System.in);

System.out.println("Enter the number between 100 and 200:");

int n=Sc.nextInt();. //To initialise variable n

int t=n;// To copy variable n to t

while(t greater than 100 and less than 200)

{

d=t%10. //loop checking condition//

if(d!=0)

{

c=c+1;

}

t=t/10;

}

if(d==n)

{

System.out.println("Numbers which do not contain zero at any position:"); //To display numbers which don't contain zero at any position//

System.out.println(c);

}

}

}

Answered by singhshourya2006
1

Answer:

import java.util.*;

public class no_zero

{

   public static void main(String args[])

   {

       Scanner in=new Scanner(System.in);

       int n,d=0,c=0;

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

       n=in.nextInt();

       int t=n;

       if(t>100 && t<200)

       {

       while(t>0)

       

       {

           

           d=t%10;

           if (d!=0)

           {

               c=c+1;

           }

           t=t/10;

       }

       if(c==3)

       {

           System.out.println("the number does not contain a zero");

       }

   }

       else

       {

           System.out.println("the number contains a zero");

       }

   

   }

}

       

Explanation:

Similar questions