Computer Science, asked by bhanutej773, 6 months ago

write a program to create a single dimensional array of 20 integers . print count of only double digit and count of only triple digit digit integers from array

urgent !! i need it from scanner class and executable in bluej

Answers

Answered by vinko111
4

Answer:

[PS: This written in python, but it should give you an idea.......]

Explanation:

Attachments:
Answered by amikkr
2

The program to create a 20 integers single dimensional array and to print only 2-digit and 3-digit integers from the array-

  • The program used-Here the program used Java. Java is an object-oriented programming language with an abstract level and as few implementation dependencies as possible. In Java programming, a One-Dimensional Array is a particular form of variable that can hold numerous values of a single data type, such as int, float, double, char, structure, pointer, and so on.
  • C.ode-

import java.util.Scanner;

public class digit

{

  public static void main(String args[])

  {

     Scanner sc= new Scanner(System.in);

     int arr[]= new int[10];

     int sum=0;

     for(int x=0; x<10; x++)

     {

        System.out.println("Input number: ");

        arr[x]= sc.nextInt();

     }

     for(int i=0; i<10; i++)

     {

        if(arr[i]>=1000 && arr[i]<=9999)

           System.out.println(arr[i]);

     }

  }

}

#SPJ3

Similar questions