"Z Code Writer" is an Online Blog for Programmer & Beginner. Here, You will Find tech, Build your Programming Skills and other Programming Language Like C, C++, HTML, Java Script Java Code, Web Designing and University Of Sialkot (USKT) CGPA / GPA Calculator etc.

Thursday, 18 July 2019

Displaying Output Values Left-Justified

Displaying Output Values Left-Justified

      If a minus sign (-) is specified before the field width, the output value will be displayed left-justified.
Suppose the value of x = 62, and y = 716. To display the values of 'x' and 'y' left-justified, the statement is written as;
           printf ( "%-5d  %-8d" ,  x,  y) ;

Displaying Character Type Data

      The format specifier %c is used in printf() function to display character type data. For example, to display the contents of a character type variable 'xy' , the printf() function is written as follows;
              printf ( "The  value  of  xy  =  %c"  ,  xy ) ;
Suppose the value of variable 'xy' is 'A', then the output of the above statement will be as:
           The  value  xy  =  A

No comments:

Post a Comment

Thanks For Visiting Here...!! I will Reply you as soon as possible.