Write a program to find and print area of square
(Java)
Answers
Answer:Java Program to Find Area of Square,Rectangle and Circle using Method Overloading
Java Program to Find Area of Square,Rectangle and Circle using Method Overloadingclass OverloadDemo.
Java Program to Find Area of Square,Rectangle and Circle using Method Overloadingclass OverloadDemo.void area(float x)
Java Program to Find Area of Square,Rectangle and Circle using Method Overloadingclass OverloadDemo.void area(float x)System. out. println("the area of the square is "+Math. ...
Java Program to Find Area of Square,Rectangle and Circle using Method Overloadingclass OverloadDemo.void area(float x)System. out. println("the area of the square is "+Math. ...void area(float x, float y)
Java Program to Find Area of Square,Rectangle and Circle using Method Overloadingclass OverloadDemo.void area(float x)System. out. println("the area of the square is "+Math. ...void area(float x, float y)System. out. ...
Java Program to Find Area of Square,Rectangle and Circle using Method Overloadingclass OverloadDemo.void area(float x)System. out. println("the area of the square is "+Math. ...void area(float x, float y)System. out. ...void area(double x)
Java Program to Find Area of Square,Rectangle and Circle using Method Overloadingclass OverloadDemo.void area(float x)System. out. println("the area of the square is "+Math. ...void area(float x, float y)System. out. ...void area(double x)double z = 3.14 * x * x;
Java Program to Find Area of Square,Rectangle and Circle using Method Overloadingclass OverloadDemo.void area(float x)System. out. println("the area of the square is "+Math. ...void area(float x, float y)System. out. ...void area(double x)double z = 3.14 * x * x;System. out.
Hey there!
The program is as follows:
import java.util.*;
class SquareArea
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the side of square");
int s = sc.nextInt();
int ar = s*s;
System.out.println("Area of square is "+ ar);
}
}
Hope it Helps You!