Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8520807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:38:05+00:00 2026-06-11T06:38:05+00:00

Can someone tell me why this code does not compute the gross pay and

  • 0

Can someone tell me why this code does not compute the gross pay and the others? There is a problem in this code wherein it does not compute like the program is wanted to. Can someone help me pinpoint the errors?

#include <stdio.h>
#include <conio.h>

int main()
{
  char fname[20];
  char lname[20];
  char IDnumber[20];
  char Position;
  float Hoursworked,Grosspay,Tax,Netpay;

  printf(" ************iG Company************** \n\n");
  printf("Enter the employee's First Name:\n");
  scanf("%s", &fname);
  printf("Enter the employee's Last Name:\n");
  scanf("%s", &lname);
  printf("Enter IDnumber:\n");
  scanf("%s",&IDnumber);
  printf("<1>Manager <2>Supervisor heart>Employee <4>Office Boy/girl \n");
  printf("Enter Position:\n");
  scanf("%s", &Position);
  switch(Position)
  {
    case '1':
      printf("Rate per hour:P150.00 \n");
      printf("No. of hours worked:");
      scanf("%d", &Hoursworked);
      Grosspay = Hoursworked * 150;
      printf("Gross: \n", Grosspay);
      Tax = Grosspay * 0.1f;
      printf("TAX:\n", Tax);
      Netpay = Grosspay - Tax;
      printf("NET PAY: \n", Netpay);
      break;
    case '2':
      printf("Rate:P100.00 \n");
      printf("No. of hours worked:");
      scanf("%d", &Hoursworked);
      Grosspay = Hoursworked * 100;
      printf("Gross:\n", Grosspay);
      Tax = Grosspay * 0.1f;
      printf("TAX: \n", Tax);
      Netpay = Grosspay-Tax;
      printf("NET PAY: \n", Netpay);
      break;
    case '3':
      printf("Rate:P70.00 \n");
      printf("No. of hours worked:");
      scanf("%d", &Hoursworked);
      Grosspay = Hoursworked * 70;
      printf("Gross: \n", Grosspay);
      Tax = Grosspay * 0.1f;
      printf("TAX:\n", Tax);
      Netpay = Grosspay - Tax;
      printf("NET PAY: \n", Netpay);
      break;
    case '4':
      printf("Rate per hour:P50.00 \n");
      printf("No. of hours worked:");
      scanf("%d", &Hoursworked);
      Grosspay = Hoursworked * 50;
      printf("Gross:\n", Grosspay);
      Tax = Grosspay * 0.1f;
      printf("TAX:\n", Tax);
      Netpay = Grosspay - Tax;
      printf("NET PAY:\n", Netpay);
      break;
    default:
      printf("Invalid");
  }
  getch();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:38:06+00:00Added an answer on June 11, 2026 at 6:38 am

    This program actually computes the value but does not print it.
    Change,

    scanf("%d",&Hoursworked);
    
    Grosspay=Hoursworked*150;
    printf("Gross: \n",Grosspay);
    Tax=Grosspay*0.1f;
    printf("TAX:\n",Tax);
    
    
    Netpay=Grosspay-Tax;
    printf("NET PAY: \n",Netpay);
    

    to

    scanf("%f",&Hoursworked); //Houseworked is declared float
    
    Grosspay=Hoursworked*150;
    printf("Gross: **%f**\n",Grosspay); //you have to specify what type to print
    Tax=Grosspay*0.1f;
    printf("TAX:**%f**\n",Tax);
    
    
    Netpay=Grosspay-Tax;
    printf("NET PAY: **%f**\n",Netpay);
    

    change the full code accordingly and you should get the result..:)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please tell me why this code will not work? It does compile.
Can someone please tell me whats wrong with this code. I'm not getting complete
Please, can someone tell me what does this.init.apply(this, arguments) do in the code below?
Could someone please tell me why the Iterator in this code does not return
Can someone tell me why the code from Starting new code onwards does not
Duplicate. See this . Can someone tell me why this does not compile under
Can someone tell me what is wrong with this code? <?php $user = $fgmembersite->UserFullName();
Can someone tell me why this processes all the files and then does it
Can someone tell me where this structure language is from? I am not familiar
this must be such a simple problem but can someone tell me why this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.