How make calculator in python We make a calculator in python using kivy module . Kivy module helps us to make android apps . First wait , If you run a kivy program in your terminal then you see a error like this To solve this problem you have to go kivy docs and follow the instruction of kivy docs. First we have to make a virtual environment and then in the virtual environment you have to install kivy . After that you have to write kivy_venv\Scripts\activate in your terminal and then run the file . If this method not work then write the comment below. LETS START CODING First we import kivy .For this we hve to write from kivy.app import App from kivy.uix.label import Label from kivy.uix.button import Button from kivy.core.window import Window from kivy.uix.gridlayout import GridLayout from kivy.uix.widget import Widget from kivy.lang import ...
HOW TO MAKE SIMPLE CALCULATOR IN JAVA
We write a program in java language to make a calculator .
First , we have to take input from the user:
For taking input from user we have to import java.util.Scanner . So ,we write import java.util.Scanner;
Taking input from the user
we have to take three input from user
1. First number
2. Mathematical operation user want to do
3. Second number
NOTE-mathematical operation only take ADDITION(+),SUBTRACTION(-),MULTIPLICATION(*) AND DIVISION(/)
For taking input we have to write :
Scanner sc=new Scanner(System.in);
System.out.println("Enter the 1st number:");
Double no1=sc.nextDouble();
System.out.println("Enter the operation:");
char cal = sc.next().charAt(0);
System.out.println("Enter the 2nd number:");
Double no2 = sc.nextDouble();
Calculating the input numbers
For calculating the numbers we have to use if and else if condition in java .
When operation input is equal to (+) then input numbers will be add.
When operation input is equal to (-) then input numbers will be subtract.
When operation input is equal to (*) then input numbers will be multiply.
When operation input is equal to (/) then input numbers will be divide.
When operation input is different then Invalid input is displayed.
Here Are The Code
Output