Input 5 values from keyboard and print only positive values

Note: This program after running shows unnecessary some numeric.
Input : 5   -4   8   9   -1
Output: 5
               8
               9


    1. #include <stdio.h>

    2. void main()
    3. {
    4. int arr[5]; //int arr[5]={5, -4, 8, 9, -1};

    5. for(int i=1; i<5; i++){
    6.     scanf("%d\n", &arr[i]);}

    7. for(int j=0; j<5;j++){
    8.     if(arr[j] > 0)
    9.         printf("%d\n", arr[j]);
    10.     }

    11. }

    একটি মন্তব্য পোস্ট করুন