0% found this document useful (0 votes)
30 views

C Program - 6

The document contains code for two C programs. The first program calculates gross salary and tax amount for an employee. The second program checks inventory level and prints notification if items are low.

Uploaded by

Michelle Lutap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

C Program - 6

The document contains code for two C programs. The first program calculates gross salary and tax amount for an employee. The second program checks inventory level and prints notification if items are low.

Uploaded by

Michelle Lutap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1.


#include <stdio.h>
int main(){
float basic, ot, holiday, gross_salary, tru;

printf("Enter the basic pay: ");


scanf("%f", &basic);
printf("Enter the OT pay: ");
scanf("%f", &ot);
printf("Enter the Holiday pay: ");
scanf("%f", &holiday);

gross_salary = basic + ot + holiday;

// Displaying output
printf("Basic Salary: %.0f \n " ,basic);
printf("OT Pay: %.0f \n" ,ot);
printf("Holiday Pay: % .0f \n",holiday);
printf("Gross salary of the employee is: %.0f \n",gross_salary);

if (gross_salary > 20000) {


tru = 0.05* gross_salary;
printf("Your Gross Salary is taxable of 5 percent and it worth of %.2f",tru);
}
else{
printf("Your Gross Salary is not Taxable");
}
}
OUTPUT
2. –
#include <stdio.h>
int main(){
char name [20];
int items;

printf("Enter the product name: ");


gets(name);
printf("No. of items in inventory: ");
scanf("%d" ,&items);

if (items <= 2) {
printf("Notification: Need to purchase %s, quantity is low! \n",name);
}
else{
printf("Message: It's sufficient! Number of items is %d",items);
}
}

You might also like