Thread: Can we input negative numbers in the output windiw

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > 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.

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, 06:41 PM
  2. Output numbers in C++
    By JOCAAN in forum C++ Programming
    Replies: 5
    Last Post: 01-04-2008, 01: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