Skip to content

Instantly share code, notes, and snippets.

@arsalanses
Created March 6, 2020 09:04
Show Gist options
  • Save arsalanses/54a0623ff1fd918363ca849131a7814a to your computer and use it in GitHub Desktop.
Save arsalanses/54a0623ff1fd918363ca849131a7814a to your computer and use it in GitHub Desktop.
#include <iostream>
#include <conio.h>
using namespace std;
// Mohit
int circumference(int length, int width) {
return (length + width) * 2;
}
// Masahat
int area(int length, int width) {
return length * width;
}
// Ghotr
float diameter(int length, int width) {
return sqrt((length*length) + (width*width));
}
// Check if square
bool check_if_square(int length, int width) {
return length == width ? 1 : 0;
}
int main() {
int length = 0;
int width = 0;
cout << "Enter length: ";
cin >> length;
cout << "Enter width: ";
cin >> width;
cout << "Mohit: " << circumference(length, width) << endl;
cout << "Masahat: " << area(length, width) << endl;
cout << "Ghotr: " << diameter(length, width) << endl;
if (check_if_square(length, width))
cout << "It's Square" << endl;
else
cout << "Not Square" << endl;
//_getch();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment