I'm testing input formatting in C with a simple program to get familiar with C's commands, and I can't seem to figure out how to format this one output to be dynamic. So here's my problem: When you enter a name, the Salary, tax, and netpay don't adjust to the space making it look crummy. If I enter a looooong first name, it will move over on the same line and not appear under it's specified column that defines the number. Here's my code:
#include <stdio.h>
main()
{
    char name[20];
    char *nameptr = name;
    double netpay, tax, salary;
    printf("Enter Name: ");
    scanf("%s", nameptr);
    printf("\nEnter salary: ");
    scanf("%lf", &salary);
    tax = (salary * 0.25);
    netpay = salary - tax;
    printf("\n\nName\t\tSalary\t  Tax\t  Netpay\n");
    printf("-------------------------------------------\n");
    printf("%s", nameptr);
    printf("%15.2lf  - %.2lf  =  %.2lf\n\n",salary, tax, netpay);
}
I want the program to let the numbers stay where they are, and not adjust by the name length.
OR
If they have to adjust, can I use the length of the name to adjust the
printf("\n\nName\t\tSalary\t  Tax\t  Netpay\n");
and
printf("%15.2lf  - %.2lf  =  %.2lf\n\n",salary, tax, netpay);
together?
Is this possible in C?
 
     
    