Thursday, 5 November 2020

JAVA program to input and print n number using array.

 

 

JAVA program to  input  and  print n number using  array :-


PROGRAM :-

import java.io.*;

class Clsarray

{

    public static void main(String args[]) throws IOException 

  

   {

      BufferedReader br = new BufferedReader(new inputStreamReader(System.in));

 

     int i, n;

     int a[] = new int[100];

      System.out.print("Enter the value of n = ");

      n =  Integer.parselnt(br.readLine());

      System.out.println("Enter the values");

       for(i =0; i<n; i++)

        {

            a[i] = Integer.parselnt(br.readLine());

 

         }

      

         System.out.println("The values are");

          for(i =0; i<n; i++

          {

              System,out.print(a[i] +" ");

            }

 

      }

 

  }

 

 

 

 

OUTPUT :-

 

Enter the value of n =5

Enter the values

10

20

30

40

50

The values are

10 20 30 40 50

 

       


No comments:

Post a Comment

Student Marks Calculation app using java

      import javax.swing. *; import java.awt.event.ActionEvent ; import java.awt.event.ActionListener ; public class Student { private J...