how to print in the same line by using c language

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.
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

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 -
yes but line 2 must be printed on the same line...... means over the line 1.....
can u give the program for that pls...
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.....
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.");
ok ok....thanks.....

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

Topic archived. No new replies allowed.