ITGUY72 - Editorial

Problem: Contest Page | CodeChef

DIFFICULTY:

EASY.

PROBLEM:

The chef is trying to solve some series problems, Chef wants your help to code it. Chef has one number N. Help the chef to find N’th number in the series.

1, 4, 9, 16, 25……

Program:

#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    while(t--){
    	long long n;
    	cin>>n;
    	cout<<(n*n)<<"\n";
    }
}

If I use endl in place of “\n” it says TLE. Do you have any idea why is it so?

endl flushes the output as well , So it takes more time

1 Like