Thursday 9 January 2014

Determine whether the given number is a multiple of 3 or not.

Input

First line contains the number of test cases T (T <= 10), then T lines follow, each contains an integer N (0 <= N <= 1000).

Output

For each test case, if N is a multiple of 3, first print N, then print the string “ is a multiple of 3”, otherwise, first print N, then print “ is not a multiple of 3” without the quotes. See sample input output for more details.

Example

Input:
3
1
6
10

Output:

1 is not a multiple of 3
6 is a multiple of 3
10 is not a multiple of 3

______________________________

#include <cstdio>

int main()
{
    int n, t;
    scanf("%d",&t);
    while(t>0){
        scanf("%d",&n);
       
        if ((n % 3) == 0)
            printf("%d is a multiple of 3\n",n);
        else
            printf("%d is not a multiple of 3\n",n);

        t--;
    }
}

No comments:

Post a Comment