• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Doubt in format and printf

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Can anyone please explain me the below code step by step otherwise It becomes difficult for me to understand.



Thanks !
 
Ranch Hand
Posts: 1032
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ankit,

Your question is a little too broad. Have you tried running your code? If so, what specific things don't you understand?
 
Ranch Hand
Posts: 182
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To answer format questions first you should know the following.........

b boolean
n c char
n d integer
n f floating point
n s string


"-" Left justify this argument
n "+" Include a sign (+ or -) with this argument
n "0" Pad this argument with zeroes
n "," Use locale-specific grouping separators (i.e., the comma in 123,456)
n "(" Enclose negative numbers in parentheses
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankit Dhebar wrote:Hello Can anyone please explain me the below code step by step otherwise It becomes difficult for me to understand.



Thanks !



I do not believe ask anyone to explain the format and printf is a good idea, what you need to do is read the specification first and try to run the code yourself and memorise and understand the result.
 
reply
    Bookmark Topic Watch Topic
  • New Topic