This java program is most Interesting java program.This program is find your guessable number.Most interesting java program .Just Copy this code and run it your system.This code Guess your number.if you like this program means please comments me .Thank you
import java.io.*;
class Find
{
int aaa[]=new int[22];
int[] find(int a[],int b[],int c[])
{
int m=0;
int nnn=0;
int kkk=0;
int mmm=1;
for(int i=0;i<21;i++)
{
if(i<7)
{
aaa[mmm]=a[m];
}
if(i>=7&&i<14)
{
aaa[mmm]=b[nnn];
nnn++;
}
if(i>=14)
{
aaa[mmm]=c[kkk];
kkk++;
}
m++;
mmm++;
}
return aaa;
}
}
class Guess
{
public static void main(String s[])throws Exception
{
System.out.print("Your Guess any number 1 to 21\n\n");
DataInputStream dis=new DataInputStream(System.in);
int a[]=new int[7];
int b[]=new int[7];
int c[]=new int[7];
int d[]=new int[7];
int e[]=new int[7];
int f[]=new int[7];
int aaa[]=new int[22];
int m=0;
System.out.print("\n\tBlock1\t\tBlock2\t\tBlock3\t\n\n");
for(int i=0;i<21;i=i+3)
{
a[m]=i+1;
b[m]=i+2;
c[m]=i+3;
System.out.print("\t"+a[m]+"\t");
System.out.print("\t"+b[m]+"\t");
System.out.print("\t"+c[m]);
System.out.println("\n");
m++;
}
System.out.print("What Block Your Guess number:");
int h=Integer.parseInt(dis.readLine());
System.out.print("\n\n");
if(h==1)
{
Find ff=new Find();
aaa=ff.find(b,a,c);
}
if(h==2)
{
Find ff=new Find();
aaa=ff.find(a,b,c);
}
if(h==3)
{
Find ff=new Find();
aaa=ff.find(a,c,b);
}
m=0;
System.out.print("\n\tBlock1\t\tBlock2\t\tBlock3\t\n\n");
for(int i=0;i<21;i=i+3)
{
a[m]=aaa[i+1];
b[m]=aaa[i+2];
c[m]=aaa[i+3];
System.out.print("\t"+a[m]+"\t");
System.out.print("\t"+b[m]+"\t");
System.out.print("\t"+c[m]);
System.out.println("\n");
m++;
}
System.out.print("What Block Your Guess number:");
h=Integer.parseInt(dis.readLine());
System.out.print("\n\n");
if(h==1)
{
Find ff=new Find();
aaa=ff.find(b,a,c);
}
if(h==2)
{
Find ff=new Find();
aaa=ff.find(a,b,c);
}
if(h==3)
{
Find ff=new Find();
aaa=ff.find(a,c,b);
}
m=0;
System.out.print("\n\tBlock1\t\tBlock2\t\tBlock3\t\n\n");
for(int i=0;i<21;i=i+3)
{
a[m]=aaa[i+1];
b[m]=aaa[i+2];
c[m]=aaa[i+3];
System.out.print("\t"+a[m]+"\t");
System.out.print("\t"+b[m]+"\t");
System.out.print("\t"+c[m]);
System.out.println("\n");
m++;
}
System.out.print("What Block Your Guess number:");
h=Integer.parseInt(dis.readLine());
System.out.print("\n\n");
if(h==1)
{
Find ff=new Find();
aaa=ff.find(b,a,c);
}
if(h==2)
{
Find ff=new Find();
aaa=ff.find(a,b,c);
}
if(h==3)
{
Find ff=new Find();
aaa=ff.find(a,c,b);
}
System.out.println("Your Guess Number is:"+aaa[11]);
}
}
0 comments:
Post a Comment