Write a program to the to find the area of square.
(Area=s*s)
Answers
Answer:
int main() {
int side, area;
printf("\nEnter the Length of Side : ");
scanf("%d", &side);
area = side * side;
printf("\nArea of Square : %d", area);
return (0);
Explanation:
Mark as brainlist ❤️ follow me
like my answer
Explanation:
Program to find the area of the square
Area of the square is the amount of space occupied by a square. Square refers to a plane figure with four equal straight sides and four right angles.
Formula
area = width × height Area of square will be calculated as : area = side2 since width = height;
Algorithm
Define the height of any one side of the square as 's.'
Calculate the area of the square by multiplying s with s
Define the area_square as the area of the square.
Complexity
O(1)
Solution
C Program
#include <stdio.h>
int main()
{
int s=13;
int area_square=s*s;
printf("Area of the square=%d",area_square);
}
Output:
Area of the square=169
PHP Program
<?php
$s=13;
$area_square=$s*$s;
echo "Area of the square=";
echo $area_square;
?>
Output:
Area of the square=169
Java Program
public class shpere{
public static void main(String args[])
{
int s=13;
int area_square=s*s;
System.out.println("Area of the square="+area_square);
}
}
Output:
Area of the square=169
C# Program
using System;
public class Program
{
public static void Main()
{
int s=13;
int area_square=s*s;
Console.WriteLine("Area of the square="+area_square);
}
}
Output:
Area of the square=169
Python Program
s=13
area_square=s*s
print("Area of the square="+str(area_square))
Output:
Area of the square=169