'Scanf' numbers into array...

This is a discussion on 'Scanf' numbers into array... within the C Programming forums, part of the General Programming Boards category; Hi, Is it possible to use scanf to input numbers from the keyboard and store them in a array? I ...

  1. #1
    Unregistered
    Guest

    'Scanf' numbers into array...

    Hi,

    Is it possible to use scanf to input numbers from the keyboard and store them in a array? I know it's possible with character strings.

    thnx

  2. #2
    Unregistered
    Guest
    #include <stdio.h>

    int main(void)
    {
    int number[5], i;
    for(i=0;i<5;i++)
    scanf("%d",&number[i]);
    for(i=0;i<5;i++)
    printf("%d\n",number[i]);
    return 0;
    }

  3. #3
    Unregistered
    Guest
    thnx worked

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. entering numbers to array in a row whithout length input
    By transgalactic2 in forum C Programming
    Replies: 55
    Last Post: 01-02-2009, 04:02 AM
  2. input row of integers via scanf into an array...
    By noodles355 in forum C Programming
    Replies: 1
    Last Post: 11-20-2006, 10:12 AM
  3. Prime Numbers and Array...
    By Deux in forum C Programming
    Replies: 12
    Last Post: 12-20-2004, 04:12 PM
  4. Type and nontype parameters w/overloading
    By Mr_LJ in forum C++ Programming
    Replies: 3
    Last Post: 01-02-2004, 01:01 AM
  5. arrays
    By john_murphy69 in forum C Programming
    Replies: 8
    Last Post: 02-11-2003, 02:33 PM

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