Monday 7 March 2016

Solution of URI 1095 :: Sequence IJ 1


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 I,J;
    for(I=1,J=60;J>=0;I=I+3,J=J-5)
        printf("I=%d J=%d\n",I,J);
    return 0;
}

5 comments:

  1. why this method is not working bro?:(
    #include
    int main()
    {
    int I=1,J=60;

    while(J!=0)
    {
    printf("I=%d J=%d\n",I=I+3,J=J-5);
    }
    return 0;
    }

    ReplyDelete
  2. #include
    int main()
    {
    int I=1,J=60;

    do
    {
    printf("I=%d J=%d\n",I,J);
    I=I+3;
    J=J-5;
    }
    while(J!=0);

    printf("I=%d J=%d\n",I,J);
    I=I+3;
    J=J-5;

    return 0;
    }

    ReplyDelete
  3. #include
    int main()
    {
    int I,J;
    for(I=1,J=60;J>=0;I=I+3,J=J-5)
    printf("I=%d J=%d\n",I,J);
    return 0;
    }

    ReplyDelete
  4. //my code is work as well but the uri won't accept me :)
    int temp;

    for(int i = 1; i <= 40; i+=3){
    for (int j = 60; j >= 0; j-=5){

    if (j >= temp){
    continue;
    }

    temp = j;


    break;
    }
    }

    ReplyDelete

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