Computer Science, asked by piyushverma7439, 1 month ago

You are given a side of a square as input. Write a program to find the perimeter and area of the square.

Answers

Answered by abhisumatkashyap
4

Python Program

s = int(input("Side : "))

area = s*s

perimeter = 4*s

print("Area of Rectangle : ",area)

print("Perimeter of Rectangle : ",perimeter)

C Program

/*

* C Program to calculate area of a square

*/

#include <stdio.h>

#include <conio.h>

 

int main(){

   float side, area;

   printf("Enter length of side of square\n");

   scanf("%f", &side);

   /* Area of Square = Side X Side */

   area = side * side;

   printf("Area of square : %0.4f\n", area);

     

   getch();

   return 0;

}

Answered by purveshKolhe
4

\huge{\green{\boxed{\red{\mathfrak{ answer : }}}}}

JAVA::

import java.util.Scanner;

public class Brainly {

public static void main(String [] args){

Scanner sc = new Scanner(System.in);

int f = sc.nextInt();

System.out.println("Perimeter is : " + (4 * f));

System.out.println("Area is : " + (f * f));

}

}

Python::

f = int(input())

print("Area is : " + (f * f))

print("Perimeter is : " + (4 * f))

C++::

#include <iostream>

using namespace std;

int main() {

int x;

cin >> x;

cout << "Area is : " << x * x << "\n";

cout << "Perimeter is : " << 4 * x;

return 0;

}

I hope that my answer helps you...

Similar questions