Sunday 27 March 2016

Solution of URI 1157 :: Divisors 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()
{
   int N,a;
    scanf("%d",&N);
    for(a=1;a<=N;a++)
    {
        if(N%a==0)
            printf("%d\n",a);
    }
    return 0;
}

1 comment:

  1. #include
    int main()
    {
    int i,n;
    float x;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
    x=n%i;
    if(x==0)
    {
    printf("%d\n",i);
    continue;
    }
    else
    continue;

    }
    return 0;
    }


    reply....

    ReplyDelete

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