Dear C Programming Community,
How would I insert a math symbol along with a numerical result in a printf statement?
Thank you,
MarkTheSpark
Dear C Programming Community,
How would I insert a math symbol along with a numerical result in a printf statement?
Thank you,
MarkTheSpark
What have you tried? Is the symbol in a specific character set?
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Insert it as a character/string
s.s.harishCode:printf("%d + %d",1,2);
Last edited by ssharish; 06-09-2005 at 05:53 AM.
should be printf("%d + %d",1,2);printf("%d + %d",1.2);
or even printf ("0"); - a mathematical symbol and a numerical result all rolled into one.
thax Jez my typing mistake
s.s.harish
check out the ascii values of the math symbols then you can use printf to print that symbols
You should also just be able to use constants.
Code:char plus = '+'; char minus = '-';