With and Without ios::sync_with_stdio(0);cin.tie(0);

With ios::sync_with_stdio(0);cin.tie(0);
#include<bits/stdc++.h>

using namespace std;

int main(){

ios::sync_with_stdio(0);cin.tie(0);

cout << “1st step” << “\n”;

int tc;

cin >> tc;

while(tc–){

cout << “hello” << “\n”;

}

}

Output:
1
1st step
hello

Without ios::sync_with_stdio(0);cin.tie(0);
Output:
1st step
1
hello

Why is the order of output different in both cases?

Ask doubt through ask your doubt button on your portal .