-1
printf("%d \% %d = %d", 4, 3, 1);

I was expecting this to print "4 % 3 = 1", but instead it prints "4 %d = 3". How can I make this print the expected result? Does "\" not disable the "%" following it?

smunteanu
  • 422
  • 3
  • 9

1 Answers1

1

%% is the pattern to escape a %, so write printf("%d %% %d = %d")

Carson
  • 2,700
  • 11
  • 24