Can we input negative numbers in the output windiw

This is a discussion on Can we input negative numbers in the output windiw within the C Programming forums, part of the General Programming Boards category; I have a simple question. Suppose we have to input a no. bu using "scanf()". Can we input negative nos. ...

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    3

    Can we input negative numbers in the output windiw

    I have a simple question.

    Suppose we have to input a no. bu using "scanf()".

    Can we input negative nos. in this case.

    Code:
         main()
         {
              int  n;
              printf("enter the number");
              scanf("%d",&n);
          }
    In this simple program can we input negative numbers in the output window.
    If yes then how.

    For negative numbers we will have to input "-" sign, how can we input it during the execution of the program.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,453
    > how can we input it during the execution of the program.
    Press the same - key that you used to compose your message.

    Try it and see.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Basic C input output program help
    By trevordunstan in forum C Programming
    Replies: 2
    Last Post: 01-27-2008, 05:41 PM
  2. Output numbers in C++
    By JOCAAN in forum C++ Programming
    Replies: 5
    Last Post: 01-04-2008, 12:01 PM
  3. Help on restricting input to a numbers only (or text only)
    By BongoBob in forum C++ Programming
    Replies: 6
    Last Post: 05-14-2006, 08:32 PM
  4. Base converter libary
    By cdonlan in forum C++ Programming
    Replies: 22
    Last Post: 05-15-2005, 01:11 AM
  5. Multi input to Output.
    By Krullt in forum C Programming
    Replies: 3
    Last Post: 09-25-2001, 02:07 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21