Advertisement
t805

Print Array Elements (Int)

Sep 10th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. const int SIZE = 5;
  4.  
  5. int main()
  6. {
  7.  
  8.     int array[SIZE];
  9.     int i;
  10.    
  11.         for(i = 0; i < SIZE; i++)
  12.         {
  13.         printf(“Enter element %d: ", i);
  14.         scanf(“%d%*c”, &array[i]);
  15.         }
  16.      
  17.         printf(“Array contents are as follows.\n");
  18.    
  19.     for(i = 0; i < SIZE; i++)
  20.         {
  21.         printf(“Element %d is %d\n“, i, array[i]);
  22.         }
  23.  
  24.     return(0);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement