1.variables and Data Types
1.variables and Data Types
3. List down all primitive data types in java in order of their capacity.
int radius=20;
double pi = 3.14, Area;
Area = pi * radius * radius;
System.out.println("Area of circle:"+Area);
}
}
Output:
6. Write a Java program to enter two numbers and perform all arithmetic
operations.
public class Arithmaticoperations {
Output:
Output:
int x = 10;
int y = 20;
x = x + y;
y = x - y;
x = x - y;
Output:
10.Write a Java program to enter marks of five subjects and calculate total and
Percentage.
public class SubjectTotalandPercentage {
public static void main(String[] args) {
Total = Maths+Science+History+Arts+Geography;
Output:
135
a= 5 b= 19
float width= 7;
float height= 8;
14.Write a Java program to convert days into years, weeks and days.
public class DaysConverter {