why it didnt compute the netincome and deduction?

Viewed 24

enter image description here

enter image description here

Hello , Iam really struggling rightnow. This program should compute the deduction and total net income. there is no error in the program. but why it didnt compute the "DEDUCTION" and the "NET INCOME" Iam using C language.

#include <stdio.h>
#include <stdlib.h>

int main()
{



  int withholdingtax;
  int sss_contribution;
  int salary;
  int netincome;
  int deduction;



  printf ("ENTER SALARY :" ,&salary);
  scanf("%d" ,&salary);
  printf("\n");

  printf ("ENTER WITHHOLDING TAX :" ,&withholdingtax);
  scanf ("%d" , &withholdingtax);
  printf("\n");

  printf ("SSS CONTRIBUTION :" ,&sss_contribution);
  scanf ("%d" , &sss_contribution);
  printf ("\n");

  deduction = (sss_contribution + withholdingtax);
  netincome = (salary = deduction);

  printf ("TOTAL DEDUCTION :" , &deduction);
  printf ("\n");

  printf ("TOTAL NET INCOME :" , &netincome);


    


    return 0;
}
1 Answers

printf ("ENTER SALARY :" ,&salary);

When just printing a string, do not include any extra arguments. Use:

printf("Enter salary: ");

printf ("TOTAL DEDUCTION :" , &deduction);
printf ("\n");

To print a number, include a conversion specification, like %d to format an int value as a decimal numeral, and pass the value of the object, not its address, and include the new-line character in the same printf, not a separate one:

printf("Total deduction: %d\n", deduction);

Related