URI / BEE CROWD 1133 - Rest of a Division - Solution in C,C++,Python | URI - BEECROWD - BEE 1133 Solution in C,C++,Python

URI / BEE CROWD 1133 - Rest of a Division - Solution in C,C++,Python | URI - BEECROWD - BEE 1133 Solution in C,C++,Python

                                                                                             beecrowd | 1133

Rest of a Division

Adapted by Neilor Tonin, URI  Brazil

                                                                                             Timelimit: 1


URI / BEE CROWD 1133 - Rest of a Division - Solution in C,C++,Python | URI - BEECROWD - BEE 1133 Solution in C,C++,Python :

Write a program that reads two integer numbers X and Y. Print all numbers between X and Y which dividing it by 5 the rest is equal to 2 or equal to 3.

Input

The input file contains 2 any positive integers, not necessarily in ascending order.

Output

Print all numbers according to above description, always in ascending order.

Input SampleOutput Sample

10
18

12
13
17

N.B: Don't copy paste the code as same. Just try to understand it and try yourself.

  URI / BEE 1133 Solution in C :   

  URI / BEECROWD Online Judge 1133 Solve  in C :                                          

#include<stdio.h>
int main()
{
    int a,b,i;

    scanf("%d %d",&a,&b);

    if(a<b)
    {
        for(i=a+1;i<b;i++)
        {
            if(i%5==2 || i%5==3)
            {
                printf("%d\n",i);
            }
        }
    }
    else if(a>b)
    {
        for(i=b+1;i<a;i++)
        {
            if(i%5==2 || i%5==3)
            {
                printf("%d\n",i);
            }
        }
    }
    return 0;
}

0 Response to URI / BEE CROWD 1133 - Rest of a Division - Solution in C,C++,Python | URI - BEECROWD - BEE 1133 Solution in C,C++,Python

Post a Comment