StudyLover
  • Home
  • Study Zone
  • Profiles
  • Contact us
  • Sign in
StudyLover 1. Program to find the area and perimeter of a rectangle.
Download
  1. C++ Programs list
2. Program to check whether a number is prime.
C++ Programs list

1.      Program to find the area and perimeter of a rectangle.

  1. #include <iostream>

  2. #include <conio.h>

  3. using namespace std;

  4. int main() {

  5.     int length, width, area, perimeter;

  6.     cout << "Enter the length of the rectangle: ";

  7.     cin >> length;

  8.     cout << "Enter the width of the rectangle:  ";

  9.     cin >> width;

  10.     // Calculate the area

  11.     area = length * width;  

  12.     // Calculate the perimeter

  13.     perimeter = 2 * (length + width);

  14.     // Display the results

  15.     cout << "Area of the rectangle: " << area << endl;

  16.     cout << "Perimeter of the rectangle: " << perimeter << endl;

  17.     getch();

  18.     return 0;

  19. }

2. Program to check whether a number is prime.
Our Products & Services
  • Home
Connect with us
  • Contact us
  • +91 82955 87844
  • Rk6yadav@gmail.com

StudyLover - About us

The Best knowledge for Best people.

Copyright © StudyLover
Powered by Odoo - Create a free website