输入一个数,若可被5整除,输出YES,否则输出NO
写法1:if语句
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
int a = 0;
scanf("%d", &a);
if (a % 5 == 0)
printf("YES");
else
printf("NO");
return 0;
}
写法2:三目操作符
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
int a = 0;
scanf("%d", &a);
a % 5 == 0?printf("YES"):printf("NO");
return 0;
}