how to print in the same line by using c language

Jan 23, 2010 at 8:11pm
if we give
printf("start:\n");
printf("\nline 1. printed");
printf("\nline 2.");

the output will be like this.....

start:
line 1. printed
line 2. printed

now how to get the output like ...
start:
line 1. printed

start:
line 2. printed
means first 'line 1.' must be printed and in the same line 'line line 2.' must be printed....

can anyone help me by telling this program....thanks.
Jan 23, 2010 at 8:20pm
Is this correct?

You have this:
1
2
3
4
printf("start:\n");

printf("\nline 1. printed");
printf("\nline 2.");
start:

line 1. printed
line 2.


You want this:
start:
line 1. printed

start:
line 2. printed

Jan 23, 2010 at 10:38pm
If you want to go back to the beginning of the line use \r instead of \n
- Once you print \n you can't go up any more with only standard stuff -
Jan 24, 2010 at 5:50am
yes but line 2 must be printed on the same line...... means over the line 1.....
can u give the program for that pls...
Jan 24, 2010 at 5:54am
if we write a count down program.....

count down 5
4
3
2
1
.....

instead of printing like this how to change that 5 4 3 2 1 in the same positon.....
Jan 24, 2010 at 10:59am
mshaneeth wrote:
yes but line 2 must be printed on the same line...... means over the line 1.....
can u give the program for that pls...

Just what I said:
1
2
3
printf("start:\n");
printf("\nline 1. printed");
printf("\rline 2.");
Jan 24, 2010 at 2:59pm
ok ok....thanks.....

what is the use of \f (form feed) in c language......

Jan 24, 2010 at 7:23pm
Topic archived. No new replies allowed.