How to do this??

This is a discussion on How to do this?? within the C Programming forums, part of the General Programming Boards category; How to do it~~ eg. input 79 --> output 7 9...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    2

    Question How to do this??

    How to do it~~
    eg. input 79 --> output 7
    9
    Last edited by faiwong; 10-22-2001 at 02:15 AM.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    25
    u do it and u'll know how to do it.........itzz juz tt simple!!
    Java ROCKZZZZ....
    java.sun.com

    Write once, run everywhere!!!!!

  3. #3
    Registered User EvenFlow's Avatar
    Join Date
    Oct 2001
    Posts
    422
    Code:
    #include <stdio.h>
    
    int main(void)
    {
    
      int usernum;
    
      printf("Enter a number: ");
      scanf("%d", &usernum);  // get the number
      printf("You entered %d\n", usernum); // print the number
    
      return 0;
    
    }
    Simple as that.
    Last edited by EvenFlow; 10-22-2001 at 06:40 PM.
    Ramble on...

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,500
    > scanf("%d", usernum); // get the number
    You forgot the &
    scanf("%d", &usernum); // get the number
    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.

  5. #5
    Registered User EvenFlow's Avatar
    Join Date
    Oct 2001
    Posts
    422
    Whoops so I did! Sorry if someone tried that and it didn't work. Thanks for pointing that out Salem. I'll fix it up.
    Ramble on...

Popular pages Recent additions subscribe to a feed

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