- 1
I wrote the code and it doesn't have "\n" at the end of the output. But it seems my code still has presentation error. any help?
Rooholah Abolhasani said:
I wrote the code and it doesn't have "\n" at the end of the output. But it seems my code still has presentation error. any help?
you just should print new line between the outputs, not after each other!
solved! There was a "\n" after last line of output.
hello how is the type of input? the judge runs the code rapidly and gives it input or runs it once and give it a text file containing input? and how can i know when the last input comes,to not to print \n ,last of it?
sadrodin1376 said:
hello how is the type of input? the judge runs the code rapidly and gives it input or runs it once and give it a text file containing input? and how can i know when the last input comes,to not to print \n ,last of it?
you can use this trick: (in java)
top of your code:
int n = in.nextInt();
int c = 0;
while (n != 0) {
c++;
. . . . . .
end of your code:
if (c > 1) {
System.out.println();
}
System.out.println(result);
n = in.nextInt();
}
please hint me in c++ !
sadrodin1376 said:
please hint me in c++ !
approximately those are same!
top of your code:
int n;
cin>>n;
int c = 0;
while (n != 0) {
c++;
. . . . . .
end of your code:
if (c > 1) {
cout>>"\n";
}
cout>>result;
cin>>n;
}
i think!!!
In order to post something you must login first. You can use the form in the top of this page.