diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/Very-Simple-Java-Calculator.iml b/.idea/Very-Simple-Java-Calculator.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/Very-Simple-Java-Calculator.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..d37c13b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SimpleCalculator/src/SimpleCalculator.class b/SimpleCalculator/src/SimpleCalculator.class new file mode 100644 index 0000000..fd54946 Binary files /dev/null and b/SimpleCalculator/src/SimpleCalculator.class differ diff --git a/SimpleCalculator/src/SimpleCalculator.java b/SimpleCalculator/src/SimpleCalculator.java index ea2cbbf..bdbc80a 100644 --- a/SimpleCalculator/src/SimpleCalculator.java +++ b/SimpleCalculator/src/SimpleCalculator.java @@ -14,6 +14,8 @@ public void showMenu() { System.out.println("2.Substraction"); System.out.println("3.Multiplication"); System.out.println("4.Division"); + System.out.println("5.factorial"); + } @@ -22,7 +24,7 @@ public double division() { double a, b; System.out.println("Enter first value"); a = scan.nextDouble(); - System.out.println("Enter first value"); + System.out.println("Enter second value"); b = scan.nextDouble(); double val = a / b; @@ -34,7 +36,7 @@ public double mutliplication() { double a, b; System.out.println("Enter first value"); a = scan.nextDouble(); - System.out.println("Enter first value"); + System.out.println("Enter second value"); b = scan.nextDouble(); double val = a * b; @@ -46,7 +48,7 @@ public double substraction() { double a, b; System.out.println("Enter first value"); a = scan.nextDouble(); - System.out.println("Enter first value"); + System.out.println("Enter second value"); b = scan.nextDouble(); double val = a - b; @@ -58,7 +60,7 @@ public double addition() { double a, b; System.out.println("Enter first value"); a = scan.nextDouble(); - System.out.println("Enter first value"); + System.out.println("Enter second value"); b = scan.nextDouble(); double val = a + b; @@ -91,6 +93,17 @@ public static void main(String[] args) { score = calc.division(); System.out.println(score); break; + case 5:{ + System.out.println("enter the number"); + int num1 = scan.nextInt(); + int a = 1; + for(int i = 1; i <= num1; i++){ + a = a*i; + } + System.out.println("the factorial is" + " " + a); + break; + } + default: System.out.println("Wrong choice"); break;