To write a C program that calculates vacation days based on years of employment, you can start by defining the number of vacation days per year of service. For example, you might allocate 10 days for the first five years, then increase it to 15 days for the next five years. Use a loop to take user input for years of employment, and then employ conditional statements to determine the total vacation days. Finally, display the result to the user. Here’s a simple structure:
<code class="language-c">#include <stdio.h>int main() { int years; printf("Enter years of employment: "); scanf("%d", &years); int vacation_days = (years <= 5) ? years * 10 : (5 * 10) + ((years - 5) * 15); printf("Total vacation days: %d\n", vacation_days); return 0; }
</code>
Copyright © 2026 eLLeNow.com All Rights Reserved.