Input and output commands: your beginning in programming

Take your first steps in programming. Learn about input and output commands, and how it allows you to communicate with your computer.

Before reaching this article, you must have read our article about algorithms. Before learning about the input and output commands, it is recommended that you already have a sense of the meaning of the algorithms.

But let’s get down to business!

What does input and output mean?

Every type of computer, from your digital wristwatch to scientific supercomputers, has mechanisms for communicating with the outside world.

  • Mechanisms that take information from outside into the computer (input).
  • Mechanisms that take information from the computer out (output).

For example: if you think about the 3-step model for creating an algorithm (discussed in the previous article), the input represents the 1st step and the output represents the 3rd step.

3-step model

And there are several ways a computer can get information in (input) and provide information out (output).

Here are some examples:

Your cell phone

Your cell phone is an excellent example of how a computer uses input and output.

The cell phone screen is an example of output

Sound output is another example of output

Screen taps are an example of input

Side buttons are examples of input

The cell phone screen and the music you listen to with your headphones are examples of output, because they are ways of displaying and sending information out of the cell.

Touch recognition and side buttons are examples of input, because they allow you to take information to inside your cell phone.


Like your cell phone, the ATM you use to withdraw money is also a good example of input and output mechanisms.

The card reader is an example of an input

The button panel is another example of input

The interface screen is an example of output

The cash dispenser is an example of output

Certainly, it has now become very clear to you the meaning of the input and output commands.

Computer input and output

In Personal Computers (PCs) the input and output devices are known as input and output peripherals.

See some examples.

Input Peripherals

In summary: the mouse, keyboard, webcam, joystick, microphone, scanner and all devices that send information signals into the computer are the input peripherals.

Output peripherals

In summary: the monitor, the speaker, the headphones, the overhead projectors and all the devices that send information signals out of the computer are the output peripherals.

Standard input and output

Among the computer’s input and output peripherals, there are two that are standard: the keyboard and the monitor, in such a way that modern computers simply don’t work without them:

Keyboard: computer’s standard input

Monitor: the computer’s standard output

If you think about it, you’ll see the logic of it!

We can use the computer without the printer or speakers, but not without the monitor.

Likewise, we can use the computer without a mouse, microphone or webcam, but not without the keyboard!

What does standard input and output have to do with programming?

In your first contact with programming, you will certainly learn to use standard input and output to write your first algorithms!

You go:

  • write commands for the algorithm to print information on the monitor (on standard output).
  • and will write commands for the algorithm to receive values typed on the keyboard by the user (from standard input).

See below the standard input and output commands in the main programming languages.

  • Java
  • C
  • C++
  • C#
  • Python

1.import java.util.Scanner;


3.public class Main {

4.     public static void main(String args[]) {


6.          // standard input command in Java

7.          Scanner sc = new Scanner(;

8.          int value = sc.nextInt();


10.          // standard output command in Java

11.          System.out.println("This message will be displayed on standard output. On the monitor.");

12.     }




2. main() {


5.     // standard input command in C

6.     int value;

7.     scanf("%d",&value);


9.     // standard output command in C

10.     printf("This message will be displayed on standard output. On the monitor.");




2. main() {


5.     // standard input command in C++

6.     int value;

7.     std::cin >> value;


9.     // standard output command in C++

10.     std::cout << "This message will be displayed on standard output. On the monitor.";



1.using System;


3.class Program {

4.     static void Main(string[] args) {


6.           // standard input command in C#

7.          int value = Convert.ToInt32(Console.ReadLine());


9.          // standard output command in C#

10.          Console.WriteLine("This message will be displayed on standard output. On the monitor.");

11.     }


1.# standard input command in Python

2.value = input()


4.# standard output command in Python

5.print('This message will be displayed on standard output. On the monitor.')

This is, of course, the simplest and easiest way to start in the universe of programming.

But this is only the beginning! Continue your journey in learning programming. Take the next step and read our article about variables.

David V. Santiago

David V. Santiago

MSc in Systems and Computing, Professor of Computer Programming, Algorithms and Data Structures.

Was this article helpful to you?

So support us and share it with others who are interested in this subject!

Share on whatsapp
Share on facebook
Share on twitter
Share on linkedin
Share on email

Follow us
on our social media.

This website uses cookies to ensure you get the best experience on our website.