It's actually indian, the arabs got it from india, and europeans got it from them, and were told by the arabs that they invented it, and thus the name.
import java.util.Scanner;
public class ******** {
public static void main(String args[]){
int firstNum; //1st number to multiply by
int secondNum; //2nd number to multiply by
int firstNumminus; //1st number - 100
int secondNumminus; //2nd number - 100
int numMinusadded; //1st and 2nd numbers added
int numMinusmultiplied; //1st and 2nd numbers multiplied
int lastNumsminus;
Scanner in = new Scanner(System.in);
System.out.println("enter the first number you want to multiply by");
firstNum = in.nextInt();
System.out.println("enter the second number you want to multiply by");
secondNum = in.nextInt();
firstNumminus = 100 - firstNum;
secondNumminus = 100 - secondNum;
numMinusadded = firstNumminus + secondNumminus;
numMinusmultiplied = firstNumminus * secondNumminus;
lastNumsminus = 100 - numMinusadded;
System.out.println(firstNum+" + "+secondNum+" = "+lastNumsminus+numMinusmultiplied);
ive only tried the example from the picture but it works
import java.util.Scanner;
public class mathagain{
public static void main(String args[]){
int firstNum; //1st number to multiply by
int secondNum; //2nd number to multiply by
int firstNumminus; //1st number - 100
int secondNumminus; //2nd number - 100
int numMinusadded; //1st and 2nd numbers added
int numMinusmultiplied; //1st and 2nd numbers multiplied
int lastNumsminus;
int answer;
Scanner in = new Scanner(System.in);
System.out.println("enter the first number you want to multiply by");
firstNum = in.nextInt();
System.out.println("enter the second number you want to multiply by");
secondNum = in.nextInt();
firstNumminus = 100 - firstNum;
secondNumminus = 100 - secondNum;
numMinusadded = firstNumminus + secondNumminus;
numMinusmultiplied = firstNumminus * secondNumminus;
lastNumsminus = (100 - numMinusadded) * 100;
answer = lastNumsminus + numMinusmultiplied;
System.out.println(firstNum+" + "+secondNum+" = "+answer);
import java.util.Scanner;
public class mathagain{
public static void main(String args[]){
int firstNum; //1st number to multiply by
int secondNum; //2nd number to multiply by
int firstNumminus; //1st number - 100
int secondNumminus; //2nd number - 100
int numMinusadded; //1st and 2nd numbers added
int numMinusmultiplied; //1st and 2nd numbers multiplied
int lastNumsminus;
int answer;
int x = 0;
while(x < 1) {
Scanner in = new Scanner(System.in);
System.out.println("enter the first number you want to multiply by");
firstNum = in.nextInt();
System.out.println("enter the second number you want to multiply by");
secondNum = in.nextInt();
firstNumminus = 100 - firstNum;
i just tried out 79 and 85 come out as 64315
as in i got the numbers 64 and 315
you have to carry the first of the second number onto the second of the first number to get the actual answer of 6715
It's almost as if (x-a) * (x-b) = X^2 - (a+b)x + ab.
To answer the description, In this case a and b are small and X is 100 so it's easy but it's not like it's anything magical. And it only works for numbers near 100 anyway. Well, rather it's only easy for numbers near 100.