I'm trying to display a result on the same line as the user inputs the data. How do I do this? Everytime I try to do this, it displays on the next line.
Example:
I get this:
Code:
Input Code 10 Digit Sum Numeric Validated
Code Value Code
1234567890
270 12 3456789075p
I want this:
Code:
Input Code 10 Digit Sum Numeric Validated
Code Value Code Value
1234567890 270 12 3456789075p
here is my code:
Code:
//Lab assignment 1b-b
//produces a validation letter for a 10 digit #
#include <stdio.h>
#include <conio.h>
void main(void)
{
int pair1, pair2, pair3, pair4, pair5, total, vchar;
printf("Input Code 10 Digit Sum Numeric Validated\n");
printf(" Code Value Code Value Code\n\n");
scanf("%2d%2d%2d%2d%2d", &pair1, &pair2, &pair3, &pair4, &pair5);
total=(pair1+pair2+pair3+pair4+pair5);
vchar=total%26+65;
printf("%8d%10d%10d%12d%2d%2d%2d%2d%c",total,vchar-65,pair1,pair2,pair3,pair4,pair5,vchar);
fflush(stdin);
getchar();
}