//Program 1. WAJP to find the Square of a number.
import java.util.*;
class Square
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int n,s;
System.out.print("Enter the Number to get Square: ");
n=sc.nextInt();
s=n*n;
System.out.println("The Square of " + n + " is "+s);
}
}
//Program 2. WAJP to find the Cube of a number.
import java.util.*;
class Cube
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int n,s;
System.out.print("Enter the Number to get Cube: ");
n=sc.nextInt();
c=n*n*n;
System.out.println("The Cube of " + n + " is "+c);
}
}
//Program 3. WAJP to find the Sum of two numbers.
import java.util.Scanner;
class AdditionOfTwoNumbers
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int a,b,c;
System.out.print("Please Enter the First Number: ");
a=sc.nextInt();
System.out.print("Please Enter the Second Number: ");
b=sc.nextInt();
c=a+b;
System.out.println("The Addition is "+c);
}
}
//Program 4. WAJP to find the Difference of two numbers.
import java.util.Scanner;
class SubtractionOfTwoNumbers
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int a,b,c;
System.out.print("Please Enter the First Number: ");
a=sc.nextInt();
System.out.print("Please Enter the Second Number: ");
b=sc.nextInt();
c=a-b;
System.out.println("The Difference of two Numbers is "+c);
}
}
//Program 5. WAJP to find the Product of two numbers.
import java.util.Scanner;
class Multiplication
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int a,b,c;
System.out.print("Please Enter the First Number: ");
a=sc.nextInt();
System.out.print("Please Enter the Second Number: ");
b=sc.nextInt();
c=a*b;
System.out.println("The Product is "+c);
}
}
//Program 6. WAJP to find the Quotient of two numbers.
import java.util.*;
class Division
{
public static void main()
{
Scanner sc=new Scanner(System.in);
float a,b,c;
System.out.print("Please Enter the First Number: ");
a=sc.nextFloat();
System.out.print("Please Enter the Second Number: ");
b=sc.nextFloat();
c=a/b;
System.out.println("The Quotient is "+c);
}
}
//Program 7. WAJP to find the Remainder of two numbers.
import java.util.Scanner;
class Remainder
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int a,b,c;
System.out.print("Please Enter the First Number: ");
a=sc.nextInt();
System.out.print("Please Enter the Second Number: ");
b=sc.nextInt();
c=a%b;
System.out.println("The Remainder is "+c);
}
}
//Program 8. WAJP to find the Average of two numbers.
import java.util.*;
class Average
{
public static void main()
{
Scanner sc=new Scanner(System.in);
float a,b,c;
System.out.print("Please Enter the First Number: ");
a=sc.nextFloat();
System.out.print("Please Enter the Second Number: ");
b=sc.nextFloat();
c=(a+b)/2;
System.out.println("The Average is "+c);
}
}
//Program 9. WAJP to find the Square of a number.
import java.util.*;
class SquareAndCube
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int n,s,c;
System.out.print("Enter the Number to get Square: ");
n=sc.nextInt();
s=n*n;
c=n*n*n;
System.out.println("The Square of " + n + " is "+s);
System.out.println("The Cube of " + n + " is "+c);
}
}
//Program 10. WAJP to find the Sum, Difference, Product and Average of two numbers.
import java.util.*;
class Average
{
public static void main()
{
Scanner sc=new Scanner(System.in);
float a,b,s,d,p,av;
System.out.print("Please Enter the First Number: ");
a=sc.nextFloat();
System.out.print("Please Enter the Second Number: ");
b=sc.nextFloat();
s=a+b;
d=a-b;
p=a*b;
av=(a+b)/2;
System.out.println("The Sum is "+s);
System.out.println("The Difference is "+d);
System.out.println("The Programs is "+p);
System.out.println("The Average is "+av);
}
}