0

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

Edited by kishore sy: n/a

5
Contributors
17
Replies
20
Views
6 Years
Discussion Span
Last Post by kishore sy
0

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

0

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

-1
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();


	}
}

Edited by -Ice-: n/a

0

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

0

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.........

0

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.

0

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

0

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");

Edited by javaAddict: n/a

0

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

0

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

0

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>);
0

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..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.