Thread: How to do this??

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

  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