fork download
  1. // C Code
  2. // This program will allow the user to define the number of values and to input values, from 1 to 10, into an array
  3. // which will output a visual representation from smallest to largest.
  4. // Developer: Joseph M. Pentecost
  5. // Date: October 10, 2019
  6.  
  7. #include <stdio.h>
  8.  
  9. int main() {
  10.  
  11. int i, arr[50], num;
  12.  
  13. printf("\n How many numbers would you like to use?");
  14.  
  15. scanf("%d", &num);
  16.  
  17. printf("\n Enter the numbers, between 1 and 10, that you would like to use.");
  18.  
  19. for (i = 0; i < num; i++) {
  20.  
  21. scanf("%d", &arr[i]);
  22.  
  23. }
  24.  
  25. for (i = 0; i < num; i++) {
  26.  
  27. printf("\n arr[%d] = %d", i, arr[i]);
  28.  
  29. }
  30.  
  31. return (0);
  32.  
  33. ]
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
5
1 2 3 4 5
compilation info
prog.c: In function ‘main’:
prog.c:33:1: error: expected statement before ‘]’ token
 ]
 ^
prog.c:33:1: error: expected declaration or statement at end of input
prog.c:15:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &num);
  ^~~~~~~~~~~~~~~~~
prog.c:21:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &arr[i]);
   ^~~~~~~~~~~~~~~~~~~~
stdout
Standard output is empty