本文介绍了如何在C中为双数据类型取mod的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想采用双数据类型的mod来检查它是否均匀。



我尝试了什么:



sry for that ...

i want to take mod of double data type to check if its even or not.

What I have tried:

sry for that...

#include <stdio.h>

 
int main()
{
     long n;
    scanf("%d",&n);
    while(n--){
        double g;
        scanf("%d",&g);
        if(((int)g)%2==0)
        printf("YES\n");
        else
        printf("NO\n");
        
    }
}



限制条件

1< = n< = 100000

1< = g< = 10 ^ 100



这里n是否定的。测试用例

和g是否定的。检查它是否均匀。

sirr它无效。


Constraints
1<=n<=100000
1<=g<=10^100

here n is the no. of test case
and g is the no. to check whether its even or not.
sirr its not working.

推荐答案

if (((int) myDouble) % 2 == 0)
   {
   // It's even.
   ...





和BTW:不要再次发誓这个网站了:这是不必要的,不专业的,不需要的。再做一次,你将被视为一个巨魔,并被禁止从该网站。



And BTW: do not swear on this site again: it was unnecessary, unprofessional, and unwanted. Do it again and you will be treated as a troll, and banned from the site.



这篇关于如何在C中为双数据类型取mod的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 12:54