Write a program to enter the length and breadth of a rectangle . Find the area, perimeter and diagonal of the rectangle. (Using inputStreamReader). (Hint: Diagonal=√(l^2+b^2 ) )
Answers
Answer:
Both diagonals of rectangle have equal length. Examples: Input : 4 5 Output : Area = 20 Perimeter = 18 Input : 2 3 Output : Area ... CPP program to find area.
Answer:
// CPP program to find area
// CPP program to find area // and perimeter of rectangle
// CPP program to find area // and perimeter of rectangle #include<bits/stdc++.h>
// CPP program to find area // and perimeter of rectangle #include<bits/stdc++.h> using namespace std;
// CPP program to find area // and perimeter of rectangle #include<bits/stdc++.h> using namespace std;
// CPP program to find area // and perimeter of rectangle #include<bits/stdc++.h> using namespace std; // Utility function
// CPP program to find area // and perimeter of rectangle #include<bits/stdc++.h> using namespace std; // Utility function int areaRectangle(int a, int b)
// CPP program to find area // and perimeter of rectangle #include<bits/stdc++.h> using namespace std; // Utility function int areaRectangle(int a, int b) { int area = a * b; return area;}
}
} int perimeterRectangle(int a, int b)
} int perimeterRectangle(int a, int b) { int perimeter = 2*(a + b); return perimeter; }
} int perimeterRectangle(int a, int b) { int perimeter = 2*(a + b); return perimeter; }
} int perimeterRectangle(int a, int b) { int perimeter = 2*(a + b); return perimeter; } // Driver program
} int perimeterRectangle(int a, int b) { int perimeter = 2*(a + b); return perimeter; } // Driver program int main()
} int perimeterRectangle(int a, int b) { int perimeter = 2*(a + b); return perimeter; } // Driver program int main() { int a = 5; int b = 6;
cout << "Area = " << areaRectangle(a, b) << endl;
cout << "Area = " << areaRectangle(a, b) << endl; cout << "Perimeter = " << perimeterRectangle(a, b);
cout << "Area = " << areaRectangle(a, b) << endl; cout << "Perimeter = " << perimeterRectangle(a, b); return 0; }