Friday 29 April 2016

Solution of URI 1174 :: Array Selection I


Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.

/**Bismillahir Rahmanir Rahim.**/

#include <stdio.h>
int main()
{
    double A[100];
    int i;
    for(i=0; i<=99; i++)
        scanf("%lf", &A[i]);
    for(i=0; i<=99; i++)
    {
        if(A[i]<=10.0)
            printf("A[%d] = %.1lf\n",i, A[i]);
    }
    return 0;
}

4 comments:

  1. i think thats wrong, because of the output, the position of the array must be the same when you input

    ReplyDelete
  2. #include
    int main()
    {
    double A[100];
    int i;
    for(i=0; i<=99; i++)
    scanf("%lf", &A[i]);
    for(i=0; i<=99; i++)
    {
    if(A[i]<=10.0)
    printf("A[%d] = %.1lf\n",i, A[i]);
    }
    return 0;
    }
    reply..

    ReplyDelete
  3. #include
    int main()
    {
    int i;
    float a[100],n;
    for(i=0;i<100;i++)
    {
    scanf("%f",&n);
    a[i]=n;
    }
    for(i=0;i<100;i++)
    {
    if(a[i]<=10)
    printf("A[%d] = %.1f\n",i,a[i]);
    }
    return 0;
    }

    reply..

    ReplyDelete

Note: only a member of this blog may post a comment.