-2

Example : 2.3666% And I am Using. But Not Working..

float n = 2.3666;
NSLog(@"%f%",n);
Joe
  • 56,979
  • 9
  • 128
  • 135
Ashvin
  • 8,227
  • 3
  • 36
  • 53
  • Just an FYI, when asking questions like this you should state what you were expecting and then what you were actually getting, either a value or the compiler warning/error itself. – Joe Apr 18 '12 at 14:07
  • -1 In what way "not working"? – JeremyP Apr 18 '12 at 14:09
  • While in general I agree with that sentiment, in this case it's so clear what's wrong that a detailed explanation is not really necessary. – R.. GitHub STOP HELPING ICE Apr 18 '12 at 14:27
  • possible duplicate of [Printing '%' with printf in C/C++](http://stackoverflow.com/questions/3156078/printing-with-printf-in-c-c) – jscs May 03 '12 at 06:12
  • Why would change the title and the question until it is nothing like the original!? – Joe May 29 '12 at 13:52

3 Answers3

8

You need to escape percent signs using %%

float n = 2.3666;
NSLog(@"%f%%",n);
Joe
  • 56,979
  • 9
  • 128
  • 135
8

Escape the %:

NSLog(@"%f%%",n);
MByD
  • 135,866
  • 28
  • 264
  • 277
0

Use %% to scape de % character in NString NSLog

OscarVGG
  • 2,632
  • 2
  • 27
  • 34