Thread: Insert Math Symbols

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    1

    Insert Math Symbols

    Dear C Programming Community,

    How would I insert a math symbol along with a numerical result in a printf statement?

    Thank you,

    MarkTheSpark

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    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.*

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Insert it as a character/string

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    184
    Code:
    printf("%d + %d",1,2);
    s.s.harish
    Last edited by ssharish; 06-09-2005 at 05:53 AM.

  5. #5
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    printf("%d + %d",1.2);
    should be printf("%d + %d",1,2);

    or even printf ("0"); - a mathematical symbol and a numerical result all rolled into one.

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    184
    thax Jez my typing mistake

    s.s.harish

  7. #7
    Registered User
    Join Date
    Jun 2005
    Posts
    4
    check out the ascii values of the math symbols then you can use printf to print that symbols

  8. #8
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    You should also just be able to use constants.

    Code:
    char plus = '+';
    char minus = '-';

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-02-2009, 07:27 AM
  2. Trouble with Windows/DirectX programming
    By bobbelPoP in forum Windows Programming
    Replies: 16
    Last Post: 07-08-2008, 02:27 AM
  3. Strange error?
    By MrLucky in forum C++ Programming
    Replies: 5
    Last Post: 02-04-2006, 03:01 PM
  4. how to use operator+() in this code?
    By barlas in forum C++ Programming
    Replies: 10
    Last Post: 07-09-2005, 07:22 PM
  5. reading math symbols
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 08-08-2003, 10:13 AM