how to read 25 digit number in java????
i want to write a porgram to perform addditon and substraction between 25 digit numbers

Recommended Answers

All 17 Replies

what do u mean by read..isit it from given data , random number or input by urself

i want to write a program to addition,substraction,multiplication&division of 25 digit number
please help me

class test
{
	public static void main(String[] args)
	{
		int count,add,sub,multi,div;
		int data[] = new int [25];
		add=0;
		sub=0;
		multi=1;
		div=1;
		count =1;

		for (int i=0 ; i < 25 ; i++)
		{
				data[i] = count;
				System.out.print(count+" ");
				count++;
		}
		System.out.println("\n");


		for (int i=0 ; i <25 ; i++)
		{
			add += data[i];
			sub -= data[i];
			multi *= data[i];
			div /= data[i];
		}
		System.out.println("addittion : "+add+" ");
		System.out.println("substaction : "+sub+" ");
		System.out.println("multiple : "+multi+" ");
		System.out.println("division : "+div+" ");
		System.out.println();


	}
}

no,
i want to write a java prodram to add/multiply/substraction/divide two 25 digit numbers

eg:1125478945632585478956321*1125478945632585478956789
or
1125478945632585478956321+1125478945632585478956356
or
1125478945632585478956321-1125478945632585478956325
or
1125478945632585478956321/1125478945632585478956325

hey, i saw
that reply is for ice not for u
sorry
please provide a syntax for converting string to biginteger, i did't understand that.
please help me.........

try using long int variables

Each hexadecimal digit represents four binary digits (bits) (also called nibble), and the first use of hexadecimal notation is a representation of the binary values encoded nice man on the computer and digital electronics.

sorry sir,
please post the program if u can,
or atlest post syntax...
any way, thanks sir that is very useful link but i am very new to java so i cant understand.. please help me

Just look at the API of the class BigInteger. Use the constructor to create the object and use the methods it has for adding, subtracting, ....

BigInteger bi1 = new BigInteger("123123414123412341241243");

thanks sir,
i will try
sir please give a syntax if u can
because i am very new to java (i know c very well

ok ok
thanks sir,

sir please give syntax for methods also
please............ sir
help me

http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/math/BigInteger.html

//BigInteger(String val)
//Translates the decimal String representation of a BigInteger into a BigInteger.

BigInteger bi1 = new BigInteger("123123414123412341241243");

If you look at that link you will find the methods that do what you want. Create 2 BigInteger objects and then call the methods you want:

BigInteger bi1 = new BigInteger("123123414123412341241243");
bi1.method(<argumnets>);

sir,
this is my last reply
please give syntax for add,substract,multiply,divide methods in BigInteger
sir
pleeeeeeeeeeese if u can, give total java prog.code for read two 25 digit numbers and perdorm add,substract,multiply,divide on those two numbers
please sir
helpme
this is my last reply
any way, i am very thank full to u sir
i am very new to java programing sir so, please help me with out hesitation..

sir,
i got it
thanks
thanks
thank you soooooooo much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.