Monday, January 7, 2013

Program To Display Different Combinations Of Entered Values Using BlueJ


In this program, five values will be entered by user and different combinations of the numbers will be displayed. In this post, the same program is done using BlueJ

BlueJ program on the combination of numbers


import java.io.*;

class Sat

{
 int i,j,x;
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
   int arr[]=new int[5];

 public void show()throws Exception
 {
    for(i=0;i< 5;i++)
{
         System.out.print("Enter value:");
         arr[i]=Integer.parseInt(br.readLine());
    }

    System.out.println("The original valoues are \n");

    for(i=0;i< 5;i++)
     System.out.print(" "+arr[i]);

    System.out.println("\nThe Combination are as follows \n");

    for(i=0;i < 5;i++)
     {
        x=i;
        for(j=0;j< 5;j++)
        {
            System.out.print(" "+arr[x]);
            x++;
            if(x> 4)
            x=0;
        }
        System.out.println();
    }
    }

public static void main(String args[]) throws Exception
{
Sat ob=new Sat();
ob.show();
}
}



Related PostBlueJ Programs on Number

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner