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({});
var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date(); (function(){ var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0]; s1.async=true; s1.src='https://embed.tawk.to/5bd7b562476c2f239ff683f0/default'; s1.charset='UTF-8'; s1.setAttribute('crossorigin','*'); s0.parentNode.insertBefore(s1,s0); })();
(adsbygoogle = window.adsbygoogle || []).push({});