calculate and print area and erimeter of square. rea=a*a Perimeter =4a Where a is side of square to be entered by user.
Answers
Answered by
0
In Java:
import java.util.*;//beginning of program
class square
{public void main ()
{
Scanner sc=new Scanner (System.in);
System.out.println ("enter side of square ");
int a=sc.nextInt ();
System.out.println("Area="+(a*a));
System.out.println("Perimeter="+(4*a));
}
}//End of program
Hope this helps
import java.util.*;//beginning of program
class square
{public void main ()
{
Scanner sc=new Scanner (System.in);
System.out.println ("enter side of square ");
int a=sc.nextInt ();
System.out.println("Area="+(a*a));
System.out.println("Perimeter="+(4*a));
}
}//End of program
Hope this helps
Similar questions
Math,
7 months ago
Political Science,
7 months ago
English,
7 months ago
English,
1 year ago
Math,
1 year ago