
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Find Fourth Side of a Quadrilateral in C++
Suppose we have three numbers a, b and c. We want to make a closed fence in a shape of arbitrary non-degenerate simple quadrilateral. We already have three sides of length a, b and c. We have to find another side d.
So, if the input is like a = 12; b = 34; c = 56, then the output will be 42, other answers are also possible.
Steps
To solve this, we will follow these steps −
return a + b + c - 2
Example
Let us see the following implementation to get better understanding −
#include<bits/stdc++.h> using namespace std; int solve(int a, int b, int c){ return a+b+c-2; } int main(){ int a = 12; int b = 34; int c = 56; cout << solve(a, b, c) << endl; }
Input
12, 34, 56
Output
100
Advertisements