URI 1072 Solve

Solve of URI 1072 (Interval 2) in C

#include<stdio.h>
int main(void){
    long long int i,n,input,in=0,out=0;
    scanf("%lld",&n);
    for(i=1;i<=n;i++){
        scanf("%lld",&input);
        if(input>=10 && input<=20)
            in++;
        else
            out++;
    }
    printf("%lld in\n%lld out\n",in,out);
    return 0;
}

3 Comments

  1. //you can use array as well
    #include
    int main()
    {
    int n,i,c=0,d=0;
    scanf("%d",&n);
    int ar[n];
    for (i=0;i=10&&ar[i]<=20){
    c++;
    }
    else d++;
    }
    printf("%d in\n%d out\n",c,d);
    return 0;

    }

    ReplyDelete
  2. //you can use array as well
    #include
    int main()
    {
    int n,i,c=0,d=0;
    scanf("%d",&n);
    int ar[n];
    for (i=0;i=10&&ar[i]<=20){
    c++;
    }
    else d++;
    }
    printf("%d in\n%d out\n",c,d);
    return 0;

    }

    ReplyDelete
  3. //you can use array as well
    #include
    int main()
    {
    int n,i,c=0,d=0;
    scanf("%d",&n);
    int ar[n];
    for (i=0;i=10&&ar[i]<=20){
    c++;
    }
    else d++;
    }
    printf("%d in\n%d out\n",c,d);
    return 0;

    }

    ReplyDelete
Previous Post Next Post