Computer Science, asked by aartiverma388, 1 year ago

write a program to accept the length of a side of a square and display its area and perimeter.

related to java programings
classX level question
plz help
urgent

Attachments:

Anonymous: Have you tried this on your own?
aartiverma388: yes but i think i m wrong

Answers

Answered by nitish8089
0
there is three method to take input in java
1.input stream reader
2.console
3.Scanner(class)
so i am using third Scanner first import them by
import java.util.Scanner; and so on...
check out this program
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int side=sc.nextInt();
int perimeter=(4*side);
System.out.println("the perimeter of square is: "+perimeter);
int area=(side*side);
System.out.println("the area of square is: "+area);
}
}
Answered by sparshsingh0506
1

Answer:

ENGLISH to run repeatedly नमस्ते नमस्ते

Similar questions