I'm working on a program that uses two functions area and perimeter to return the area and perimeter of a square. The following code i wrote returns area correctly but produces a garbage value for perimeter. Can you correct what i'm doing wrong?
#include<iostream>
#include<cmath>
using namespace std;
int area(int s)
{
int area = s * s;
return area;
}
double perimeter()
{
int s;
int perimeter = 4 * s;
return perimeter;
}
int main()
{
int s;
cout << "enter the side: "
<< endl;
cin >> s;
cout << "area of square is "
<< area(s) << endl;
cout << "perimeter of square 25. is" << perimeter() << endl;
}