Discover the answers you need at Westonci.ca, where experts provide clear and concise information on various topics. Get quick and reliable solutions to your questions from knowledgeable professionals on our comprehensive Q&A platform. Get quick and reliable solutions to your questions from a community of experienced experts 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.
Thank you for your visit. We're dedicated to helping you find the information you need, whenever you need it. Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. Get the answers you need at Westonci.ca. Stay informed with our latest expert advice.