Computer Science, asked by nashik810, 1 month ago

Write a program to enter the side of a square and print its area and perimeter in C++ program.​

Answers

Answered by Anonymous
89

Answer:

This is the required program for the question in C++:

#include <iostream>

using namespace std;

int main()  {

   float s,p,a;

   cout << "Enter the side of the square: ";

   cin >> s;

   a=s*s;

   p=4*s;

   cout << "Area of the square is " << a << " square units.\n";

   cout << "Perimeter of the square is " << p << " units.";

   return 0;

}

Algorithm:

  • Accepting the side of the square.
  • Calculate the perimeter and area using formula.
  • Display the perimeter and area of the square.
Attachments:
Answered by Khushi20993
3

Answer:

I think it helpful for you

Attachments:
Similar questions