At Westonci.ca, we connect you with the answers you need, thanks to our active and informed community. Discover a wealth of knowledge from experts across different disciplines on our comprehensive Q&A platform. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our platform.
Sagot :
Answer:
Following are the program to this question:
import java.util.*;//for user-input value
public class Project01//Decalring a class Project01
{
public static void main(String asq[])//main method
{
int ax1,ax2;//Decalring integer variables
Scanner oscr=new Scanner(System.in);//creating Scanner class Object
System.out.print("Enter the First number: ");//print message
ax1=oscr.nextInt();//input first number
System.out.print("Enter the Second number: ");//print message
ax2=oscr.nextInt();//input second number
System.out.println(ax1+ "+"+ax2+"= "+(ax1+ax2));//use print method to perform the arithmetic operation
System.out.println(ax1+"-"+ax2+"= "+(ax1-ax2));//use print method to perform the arithmetic operation
System.out.println(ax1+"*"+ax2+"= "+(ax1*ax2));//use print method to perform the arithmetic operation
System.out.println(ax1+"/"+ax2+"= "+(ax1/ax2));///use print method to perform the arithmetic operation
System.out.println(ax1+"%"+ax2+"= "+(ax1%ax2));//use print method to perform the arithmetic operation
System.out.println("The average of your two numbers is: "+(ax1+ax2)/2);//calculating average
}
}
Output:
Please find the attached file.
Explanation:
In the program, inside the class "Project01" and the main method two integer variable "ax1,ax2" is declared that uses the scanner class concept for input the value from the user-end, and in the next step, it uses the print method with the arithmetic operation to perform and prints its calculated value.
We hope this information was helpful. Feel free to return anytime for more answers to your questions and concerns. Thank you for choosing our platform. We're dedicated to providing the best answers for all your questions. Visit us again. We're glad you visited Westonci.ca. Return anytime for updated answers from our knowledgeable team.