# C Output Ask computer to write something for you

Output means to display data on screen or write the data to a printer or a file. In this tutorials we will look on one of these function.

# printf

The printf statement allows you to send output to standard out. For us, standard out is generally the screen (although you can redirect standard out into a text file or another command).

Here is program that will help you learn printf , Please do all the tasks given below to understand it's variations :

The portion in quotes is called the format string and describes how the data is to be formatted when printed. The format string can contain

  • string such as “Hello World”
  • symbols for carriage returns (\n)
  • operators as placeholders for variables .

TASKS


  1. Generate following output :
Hello World
Hello World
1
2

Hint:

Use following Escape sequence

\a    Alarm or Beep   
\b    Backspace
\f    Form Feed
\n    New Line
\r    Carriage Return
\t    Tab (Horizontal)
\v    Vertical Tab
\\    Backslash
\'    Single Quote
\"    Double Quote
\?    Question Mark
\ooo  octal number
\xhh  hexadecimal number
\0    Null
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(adsbygoogle = window.adsbygoogle || []).push({});