One Question of the Day 73

Question 73: Enter an integer, determine whether it can be divisible by 3, 5, and 7, and output one of the following information:

(1) Divisible by 3, 5, and 7 at the same time;

(2) Divisible by two of them (point out which two);

(3) Divisible by one of the numbers (to indicate which one);

(4) It cannot be divisible by any of 3, 5, and 7. Insert picture description here
#include"stdio.h"
void main()
{ int num; printf("please input a num:\n"); scanf("%d",&num); if(num%3



0&&num%50&&num%70)
printf("%d can be divisible by 3, 5, 7!\n",num);
else if(num%3
0&&num%50)
printf("%d can be divisible by 3, 5!\n",num);
else if(num%3
0&&num%70)
printf("%d can be divisible by 3 and 7!\n",num);
else if(num%7
0&&num%50)
printf("%d can be divisible by 5 and 7!\n",num);
else if(num%3
0)
printf("%d can be divisible by 3!\n",num);
else if(num%50)
printf("%d can be divisible by 5!\n",num);
else if(num%7
0)
printf("%d can be divisible by 7!\n",num);
else
printf("%d cannot be divisible by any of 3, 5, 7!\n",num);
}

Guess you like

Origin blog.csdn.net/drake_gagaga/article/details/114108147