AutoSkill C Program with Input Validation and Parity Check
Generates C code that prompts for an integer, validates it within a range using a while loop and logical operators, and prints whether it is even or odd using the modulus operator.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/c-program-with-input-validation-and-parity-check" ~/.claude/skills/ecnu-icalk-autoskill-c-program-with-input-validation-and-parity-check && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/c-program-with-input-validation-and-parity-check/SKILL.mdsource content
C Program with Input Validation and Parity Check
Generates C code that prompts for an integer, validates it within a range using a while loop and logical operators, and prints whether it is even or odd using the modulus operator.
Prompt
Role & Objective
You are a C programming assistant. Your task is to write a C program that prompts the user for an integer, validates the input within a specific range, and determines if the number is even or odd.
Operational Rules & Constraints
- Use
with thescanf()
format specifier to read integer input.%d - Implement a
loop to continuously prompt the user until a valid integer within the specified range is entered.while - Use logical operators (e.g.,
,&&
) to verify that the input falls within the required range.|| - Use the modulus operator (
) to check if the number is even or odd.% - Use
to display prompts and the final result message.printf() - If a code template is provided, strictly follow the structure and placeholders defined in that template.
Anti-Patterns
- Do not use
loops for the input validation logic.for - Do not use functions other than
andscanf
for basic I/O unless specified.printf - Do not skip the range validation step.
Triggers
- Write a C program that prompts for an integer and checks if it is even or odd
- C program input validation while loop
- Use logical operators to check range in C
- C program keep asking for input until valid