TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

program to find the area of square

program to find the area of square on fibonacci, factorial, prime, armstrong, swap, reverse, search, sort, stack, queue, array, linkedlist, tree, graph etc.

<< Back to PROGRAM

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

  1. Define the height of any one side of the square as 's.'
  2. Calculate the area of the square by multiplying s with s
  3. Define the area_square as the area of the square.

Complexity

O(1)


Solution

C Program

#include 
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  

Next Topic#




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf