InterviewSolution
Saved Bookmarks
| 1. |
Format Specifier C |
|
Answer» Format Specifier C EXAMPLE for Format Specifier(1)Use of %d in C program In above example we use %d to print integer value of x and y Output:- Value of x is:2 Value of y is:4 (2)Use of %u in C program In above program we use %u to display value of x and y by USING unsigned format specifier. Here value of x is positive and for negative value it not print value of c and will change the value of -10.Output:- Value of x is:10 Value of y is:4294967286 (3)Use of %o in C program In above program we will get value of octal and integer for a specific common value.Output:- Octal Value of x is:100 Integer Value of x is:64 (4)Use of %X and %x in C program In above code y contains the hexadecimal value "A" and it is shown in two format ONE is "a" and another is "A" which is smaller and capital X. ANd when we use %d then it is shown in integer values.Output:- Hexadecimal Value of y is:a Hexadecimal Value of y is:A Integer Value of y is:10 (5)Use of %f in C program In above code will print value of y as floating upto 6 charactersOutput:- Floating point value of y is: 3.400000 (6)Use of %e in C program In above code output will be exponent part will be printOutput:- Exponential value of y is: 3.000000e+00 |
|