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

Countdown Timer

DEMO-C-32 • Programming in C

Browser-only practice

بيان المشكلة

Write a C program that prints a countdown from 20 to 1, with each number on a new line.

The program should use a loop to generate the countdown sequence. This simulates a simple countdown timer that might be used for a rocket launch or other time-sensitive event.

Example: If your program runs correctly, it should output:

20 19 18 ... 3 2 1

قيود

Use only basic C syntax Must use a loop (for, while, or do-while) No arrays or advanced data structures Output must be exactly as specified

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

This program takes no input. It should run and produce the countdown sequence automatically.

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

Print the numbers from 20 down to 1, each on a separate line.

There should be exactly 20 lines of output, with the first line containing "20" and the last line containing "1".

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

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

العينة رقم 1
عينة ظاهرة
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
Sample test case showing the complete countdown from 20 to 1

Web terminal

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

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