السابق التالي
0 / 13
الوحدة النمطية DEMO-32-56DEMO-C-32

Age Classifier

DEMO-C-32 • Programming in C

Browser-only practice

بيان المشكلة

Write a C program that reads a person's age and determines whether they are eligible to vote. In most countries, the voting age is 18 or older. Your program should read an integer representing a person's age and print whether they can vote or not.

If the person is 18 years or older, print "Eligible to vote". Otherwise, print "Not eligible to vote".

قيود

The age will be a non-negative integer Age will be less than 150

تنسيق الإدخال

The input consists of a single integer representing the person's age.

تنسيق الإخراج

Print exactly one of the following messages:

  • "Eligible to vote" (without quotes) if the person is 18 or older
  • "Not eligible to vote" (without quotes) if the person is younger than 18

حالات اختبار نموذجية

Submit runs every public testcase in this browser. Results and code never leave this device.

العينة رقم 1
عينة ظاهرة
25
Eligible to vote
Age 25 is greater than or equal to 18, so the person is eligible to vote.
العينة رقم 2
عينة ظاهرة
17
Not eligible to vote
Age 17 is less than 18, so the person is not eligible to vote.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
إعدادات المحرر