Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

printing out an array in c from user input

#include <stdio.h>
 
int main()
{
    int a[1000],i,n;  
 
     printf("Enter size of array: ");
    scanf("%d",&n);
 
     printf("Enter %d elements in the array : ", n);
    for(i=0;i<n;i++)
    {
        scanf("%d", &a[i]);
    }
 
    printf("
Elements in array are: ");
    for(i=0;i<n;i++)
 
    {
        printf("%d  ", a[i]);
    }
 
    return 0;
}
Source by javatutoring.com #
 
PREVIOUS NEXT
Tagged: #printing #array #user #input
ADD COMMENT
Topic
Name
3+3 =