Computer Applications
Write a program to calculate and display the value of the given expression:
(a2+b2)/(a-b),when a=20, b=15
Java
Input in Java
48 Likes
Answer
public class KboatEvalExp
{
public static void main(String args[])
{
int a = 20, b = 15;
double result;
result = (a * a + b * b) / (a - b);
System.out.println("Result = " + result);
}
}
Output
Answered By
28 Likes
Related Questions
Explain if-else construct
Explain if-else-if construct
Write a program to calculate the gross salary of an employee when
Basic Salary = Rs.8600
DA = 20% of Salary
HRA = 10% of Salary
CTA = 12% of the Salary.
Gross Salary = (Salary + DA + HRA + CTA)Write a program to accept Principal, Rate and Time. Calculate and display the interest accumulated for the first year, second year and the third year compound annually.
Sample Input:
Principal = ₹5,000, Rate = 10% per annum, Time = 3 yearsSample Output:
Interest for the first year: ₹500
Interest for the second year: ₹550
Interest for the third year: ₹605