IDNLearn.com: Where your questions meet expert advice and community support. Get thorough and trustworthy answers to your queries from our extensive network of knowledgeable professionals.
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.
Your participation means a lot to us. Keep sharing information and solutions. This community grows thanks to the amazing contributions from members like you. Find clear answers at IDNLearn.com. Thanks for stopping by, and come back for more reliable solutions.