My issue
why to use while loop
My code
// Change the 'custom inputs' below and click 'run'
// Click on 'Submit' once you have tried out to proceed to the next problem
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int N;
cin>>N;
cout<<N+1<<endl;
}
return 0;
}
Learning course: C++ for problem solving - 1
Problem Link: CodeChef: Practical coding for everyone
@keshav76
Because u have to run your code for t test cases so u have to loop it for t test cases and then take input for each test case and then write your code.
you have to use looping in code like
for(int i=0;i<t;i++){
}
//This is a example of for loop.[quote=“ch_jiwanshu, post:3, topic:110566, full:true”]
you can also use for loop like
for(int i=0;i<t;i++){
}
[/quote]
here u can also use for loop , if u are comfortable with it. Here while loop is used to run the test case that u will enter n test case and it will take and run the input that n times. As mentioned in question to take test case.