0
#include<iostream>
using namespace std;
int main(){
    int t;
    t=1;
    cout<<"--1--"<<"\n";
    cout<<++t + ++t<<"\n";
    t=1;
    cout<<++t <<"\t"<< ++t<<"\n";
    t=1;
    cout<<"--2--"<<"\n";
    cout<<++t + t++<<"\n";
    t=1;
    cout<<++t <<"\t"<< t++<<"\n";
    t = 1;
    cout<<"--3--"<<"\n";
    cout<<++t + t++ + ++t<<"\n";
    t = 1;
    cout<<++t <<"\t"<< t++ <<"\t"<< ++t<<"\n";
    t = 1;
    cout<<"--4--"<<"\n";
    cout<<++t + t++ + t++<<"\n";
    t = 1;
    cout<<++t <<"\t"<< t++ <<"\t"<< t++<<"\n";
    t = 1;
    cout<<"--5--"<<"\n";
    cout<<t++ + t++ + t++<<"\n";
    t = 1;
    cout<<t++ <<"\t"<< t++ <<"\t"<< t++<<"\n";
    t = 1;
    cout<<"--6--"<<"\n";
    cout<<t++ + t++ + ++t<<"\n";
    t = 1;
    cout<<t++ <<"\t"<< t++ <<"\t"<< ++t<<"\n";
    t = 1;
    cout<<"--7--"<<"\n";
    cout<<++t + ++t + t++<<"\n";
    t = 1;
    cout<<++t <<"\t"<< ++t <<"\t"<< t++<<"\n";
    t = 1;
    cout<<"--8--"<<"\n";
    cout<<++t + t++ + ++t + ++t<<"\n";
    t = 1;
    cout<<++t <<"\t"<< t++ <<"\t"<< ++t <<"\t"<< ++t<<"\n";
    t=1;
    cout<<"--9--"<<"\n";
    cout<<++t + t++ + ++t + t++<<"\n";
    t=1;
    cout<<++t <<"\t"<< t++ <<"\t"<< ++t <<"\t"<< t++<<"\n";
}

Here I am trying to figure out how the out come is coming.

--1--
6
3       3
--2--
5
3       1
--3--
9
4       2       4
--4--
8
4       2       1
--5--
6
3       2       1
--6--
7
3       2       4
--7--
9
4       4       1
--8--
14
5       3       5       5
--9--
13
5       3       5       1
Aakash Shivanshu
  • 11
  • 1
  • 1
  • 3
  • 5
    I really am curious why so many variants of this question keep showing up. Is there like an online course with a "Can _you_ tell what happens with this line of code?" brain teaser that people keep encountering? – Nathan Pierson May 21 '21 at 17:49
  • Turn on compiler warnings. Fix those warnings. – Eljay May 21 '21 at 17:52
  • "only 1% percent of programmers know the output of these statements!" – Stack Danny May 21 '21 at 17:54

0 Answers0