Unsolved Programs
1) Write a program to calculate and display the value of the given expression:
a2+b2 / a-b , when a=20 , b=15.
Sol:- public class u1
{
public static void main()
{
int a=20, b=15, s=0;
s=(a*a+b*b)/(a-b);
System.out.println("The Output of given expression is "+s);
}
}
2) Write a program to calculate the gross salary of an employee when
Basic Salary = Rs. 8600
DA=20% of Basic Salary
HRA= 10% of Basic Salary
CTA= 12% of the Basic Salary
Gross Salary= (Salary+DA+HRA+CTA)
Display the gross salary.
Sol:-
public class u2
{
public static void main()
{
int b=8600, gross,da,hra,cta;
da=8600*20/100;
hra=8600*10/100;
cta=8600*12/100;
gross=b+da+hra+cta;
System.out.println("The Gross Salary is "+gross);
}
}
3)