Calculate area of a square
C Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,res;
printf("Enter length/side of a square:");
scanf("%d",&a);
res = a*a;
printf("Area of the square is: %d",res);
}
Java Program
import java.util.Scanner;
public class SimpleProgram10 {
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
System.out.print("enter length/side of a square:");
int side = s.nextInt();
System.out.print("The area of the square is " + (side*side));
}
}
Python Program
x = int(input("Enter the side of a square: "))
print("The area of the square is : " + str(x*x))
0 Comments:
Post a Comment