File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ #include < cmath>
3+ using namespace std ;
4+ int main (){
5+ int a,b,c,N;
6+ cout<<" Enter the value of a,b,c : " ;
7+ cin>>a>>b>>c;
8+
9+ N = 2 * abs (a-b); // circle ka size kyuki a or b aamne samne h toh toh unke bich m aadhe element hi honge circle ke toh unka double sare element honge!
10+
11+ // N need to be even and non zero if not even no condition will we followed
12+
13+ if (N%2 ==0 && N!=0 && c<=N){
14+ // c N se choti hi honi chahiye
15+
16+ // c ke opposite wala num bhi N/2 dur hi hona chahiye kyuki even h toh symmetry follow hogi!
17+ // cout<<"opposite of c is "<<c+N/2<<endl;
18+
19+ // ab agr input a=1,b=3,c=4 kr rhe h toh output 6 aarha h jb ki N toh 4 hi h or output 2 aana chahiye jo ki ' c - N/2 '
20+
21+ // toh fir kuch case or bnenge!!
22+ if (c+N/2 >=N){
23+ cout<<" opposite of c is " <<c-N/2 <<endl;
24+ } else {
25+ cout<<" opposite of c is " <<c+N/2 <<endl;
26+ }
27+ }
28+
29+ else {
30+ cout<<" -1\n " ;
31+ }
32+ return 0 ;
33+ }
You can’t perform that action at this time.
0 commit comments