pangfengliu / programmingtasks

programming tasks from my courses
68 stars 17 forks source link

3, 5, and 7 #7

Open pangfengliu opened 10 years ago

pangfengliu commented 10 years ago

Task Description

Write a program to print 0 if the input x is a multiple of 3, and a multiple of 5, but not a multiple of 7. Otherwise just print 1.

Input Format

There is one line in the input. The line has a number x.

Output Format

There is one line in the output. The line has 0 if the input x is a multiple of 3, and a multiple of 5, but not a multiple of 7. Otherwise the output is 1.

Sample Input

15

Sample Output

0

Sample Input

105

Sample Output

1

Test Data

You can download the test data (which JudgeGirl uses) from here.

linsanity711 commented 6 years ago

include

int main(void) { int number; int value, printed_value; scanf("%d", &number); value = ( number % 3 ) == 0 && ( number % 5 ) == 0 && ( number % 7 ) != 0 ; printed_value = !value; printf("%d", printed_value); return 0; }

Stacyaaa commented 1 month ago

include

main() { int x; scanf("%d", &x); if ((x % 15 == 0) && (x % 7 != 0)) printf("%d",0); else printf("%d", 1); return 0; }