Write a c++ program to find area of square
Answers
Solution :
#include <iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
int main() {
// Declare Variables
float length, area;
cout << "\nEnter the length of the side of the square : ";
cin>>length;
area = length *length;
cout << "\nArea of Square : " << area;
getch();
return (0);
}
Additional Information :
Suppose that you need to write a c++ program to find the area of a circle or a rectangle, its almost the same thing ; just define the variables required and define the formula to calculate and its done.
______________________________________________________
Answer:
Explanation:
Question:
Write a c++ program to find area of square
Solution:
//Program to find the area of a Square
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
float s,a;
printf("Enter the side");
scanf("%f",&s);
a=s*s;
printf{"area of the square is %f",a);
getch();
}
then press F2 to save the program
↓
Then press Alt + F9 to compile (for transilating High level language into machine language) Compiler and Interpretor are the transilators used
↓
Then press Ctrl + F9 to run ther program
→ enter the side
→ press enter key