Program Days
import [Link];
public class Days
{
public static void main(String args[])
{
Scanner in = new Scanner([Link]);
int a,b,c,y,d;
[Link](" Enter the number of days: ");
a=[Link]();
y=a/365;
b=a%365;
c=b/30;
d=b%30;
[Link](" Number of years= "+y);
[Link](" Number of months= "+c);
[Link](" Number of days ="+d);
}
}
Output
Enter the number of days:
56
Number of years= 0
Number of months= 1
Number of days =26
Program Arithematic_Operators
public class Arithematic_Operator
{
public static void main(int a, int b, int c)
{
int d;
[Link](" The sum of 3 digit number is: ");
d=a+b+c;
[Link](d);
}
}
Output
The sum of 3 digit number is:
2024
Program Sum_Average
public class Sum_Average
{
public static void main(int a, int b, int c)
{
int d;
d=a+b+c;
[Link](" The sum is: "+d);
double Avg = d/3;
[Link](" The average is: " +Avg);
}
}
Output
The sum is: 107
The average is: 35.0
Program Employee
import [Link];
public class Employee
public static void main(String args[])
Scanner in = new Scanner([Link]);
int basic;
[Link](" Enter the basic:" );
basic=[Link]();
double DA;
DA=basic*30/100;
[Link](" The value of DA is "+DA);
double HRA;
HRA=basic*15/100;
[Link](" The value of HRA is "+HRA);
double PF;
PF=basic*12.5/100;
[Link](" The value of PF is " +PF);
double Gross_pay;
Gross_pay=basic+DA+HRA;
[Link](" The Gross_pay is:" +Gross_pay);
double Net_pay;
Net_pay=Gross_pay-PF;
[Link](" The Net_pay is:" +Net_pay);
Output
Enter the basic:
78
The value of DA is 23.0
The value of HRA is 11.0
The value of PF is 9.75
The Gross_pay is:112.0
The Net_pay is:102.25
Program Diagonal
import [Link];
public class Diagonal
public static void main(String argd[])
Scanner in = new Scanner([Link]);
double a,b,d,s;
[Link](" Enter the diagonal of a square: ");
d=[Link]();
s=[Link]();
a = s*s;
b = 4*s;
double diagonal=d/[Link](2);
[Link](" The perimeter is:= "+ b );
[Link](" The area is= "+ a );
Output
Enter the diagonal of a square:
The perimeter is:= 32.0
The area is= 64.0