Professional Documents
Culture Documents
Huge Integer
Huge Integer
void output()
{
System.out.println("The Elements Are");
for(int i=0;i<n;i++)
{
System.out.println(arr[i]);
}
void add()
{
int i,j;
int c;
System.out.println("Input the index of 2 numbers you want to
add");
i=sc.nextInt();
j=i;
i=sc.nextInt();
c=arr[i]+arr[j];
System.out.println("Sum is"+c);
}
void subtract()
{
int i,j;
int c;
System.out.println("Input the index of 2 numbers you want to
subtract");
i=sc.nextInt();
j=i;
i=sc.nextInt();
c=arr[j]-arr[i];
System.out.println("Difference is"+c);
}
boolean isEqualTo()
{
int i,j;
int c;
return false;
}
}
}
class hugeIntegerMain
{
public static void main(String args[])
{
hugeInteger obj=new hugeInteger();
obj.input();
obj.output();
obj.add();
obj.subtract();
obj.isEqualTo();
obj.isLessorGreat();
}
Output:
Enter the number of elements
3
Enter 3 10 digit numbers
500
500
100
Input the index of 2 numbers you want to add
0
2
Sum is 600
Input the index of 2 numbers you want to subtract
0
2
Difference is 400