1.

Write a program to display all two digit numbers whose units digit is twice the tens digit . Example- The numbers 12,24, 36 satisfies the above condition.Iteration or Loops in Java.​

Answer»

d Answer:-Question:Write a program in Java to display all the two numbers whose unit digit is TWICE the TENS digit. Solution:Here comes the program. public class Number {  public static void main(STRING[] args) {     System.out.print("Numbers are:  ");     for(int i=10;i<100;i++)  {        int x=i%10, y=i/10;        if(x==2*y)           System.out.print(i+" ");     }  }}Algorithm:STARTIterate a loop in the range 10 to 99.Find the last and first digit of each values of 'i'.Check if the ones digit is twice the tens digit. If true, display the VALUE of 'i'STOPRefer to the attachment for OUTPUT ☑.



Discussion

No Comment Found