follow these instructions to complete your assignment: 1. write a flowchart and c code for a program that…

follow these instructions to complete your assignment: 1. write a flowchart and c code for a program that does the following: - asks a user the number of years of employment service - uses an else...if statement to display the following messages - service greater than 25 years - you receive a gold watch - service greater than 15 but less than 25 years - you receive a silver pen - service greater than 5 but less than 15 years- you receive an attractive pin - service between 0 and 5 years - you receive a pat on the back - be sure that you are using a logical operator to include all values. - dont forget to add curly brackets with each condition. - feel free to use logical operators in the conditions - this is not required. 2. review the output below to check your work. 3. paste the following three items into a word document (.docx): a. your flowchart in flowgorithm
Answer
Explanation:
Step1: Write flowchart in text - start
- Start symbol.
- Input the number of years of employment service (let's call it
years). - Decision box:
if (years > 25)- If true, output "You receive a gold watch" and then go to end.
- If false, go to next decision.
- Decision box:
if (years > 15 && years < 25)- If true, output "You receive a silver pen" and then go to end.
- If false, go to next decision.
- Decision box:
if (years > 5 && years < 15)- If true, output "You receive an attractive pin" and then go to end.
- If false, go to next decision.
- Decision box:
if (years >= 0 && years <= 5)- If true, output "You receive a pat on the back" and then go to end.
- End symbol.
Step2: Write C - code
#include <stdio.h>
int main() {
int years;
printf("Enter the number of years of employment service: ");
scanf("%d", &years);
if (years > 25) {
printf("You receive a gold watch\n");
} else if (years > 15 && years < 25) {
printf("You receive a silver pen\n");
} else if (years > 5 && years < 15) {
printf("You receive an attractive pin\n");
} else if (years >= 0 && years <= 5) {
printf("You receive a pat on the back\n");
}
return 0;
}
Answer:
Flowchart described in Step1 and C - code in Step2.