Next
0 / 7
Module DEMO-32-58DEMO-C-32

Count to Twenty

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

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

Your program should use a loop to generate and display the sequence of integers starting from 1 and ending at 20. Each number should be printed on its own line.

This is a simple exercise to practice basic loop constructs in C programming.

Constraints

No input is required Use a loop structure (for, while, or do-while) Print exactly one number per line Numbers must be in ascending order from 1 to 20

Input Format

This program takes no input. It should run and produce output directly.

Output Format

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

Example: 1 2 3 ... 20

Sample Testcases

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

Sample #1
Public sample
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Sample test case showing the expected output format with numbers 1 through 20, each on a new line.

Web terminal

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

Saved in this browser
Editor settings