2 like 0 dislike
364 views

若一個正整數的奇數位數字和與偶數位數字和兩者差的絕對值是11的倍數,則這個正整數就是11的倍數,否則就不是11的倍數。

請寫一個程式來判斷輸入的數是不是十一的倍數。

 

輸入說明:

會輸入一個正整數N,N不會超過1000位。

 

輸出說明:

如果輸入的數字是11的倍數就在螢幕上輸出YES,否則就輸出NO。

 

輸入範例:
 

11111111111111111111111111111111111111111111111111



 

輸出範例:

 

YES

 

[Normal] Coding (C) - asked in 2017-1 程式設計(一)AD by (30k points)
ID: 38154 - Available when: Unlimited - Due to: Unlimited
| 364 views

6 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()
{
* ** * ** ** * arr[1000];
   int even=0,odd=0,i,n,sum;
* ***** * * * * *** ** * * *** * * ***
* *** **** * ** ** * *
* ** * *** ** * **** * **** * *
* * * * * ** ** * * *
   {
** *** * ** ** * * *********** ****
* * ***** * ** * *** * *** ** ** * ** * ** * * *
* * * * *** * ** * * *** ****
* * * * *** * ****** * ****** ** * *** ** ***
   }
* * * * * * * * *** **
*** * **** ** * * *
* **** * **** * * ** *** * * **** * **
* * ** ** * *** ** * *****
* * ** * * * * *** **** * **** *

* * * ** *** * *** 0;
}
answered
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()
{
* * * ** ** ** arr[1000];
   int even=0,odd=0,i,n,sum;
** ** * ** * * * *** *** * ** **
*** **** * ** ** * * * **
*** * * * * * * ** ** *** *
* * ** * ** *** * *****
   {
** ** ****** * ** * * * ** * * * **
*** * ** *** ** ** * *** ** ** ***** ** * * ******
* **** ** ** ** ** ** * **** **
** ** ****** * ** ** **** ***** * * * * * * ** * * *** * * ** *** *
   }
* * * ** ** *** * *
*** *** *** *** ** *
**** *** * **** **** * ** ** * **
** *** ***** * *
* ** * * * *** ** * ** ** * * ** *

********* ** * ****** 0;
}
answered by (190 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()
{
** ** *** * ** * arr[1000];
   int even=0,odd=0,i,n,sum;
** * * * * * ** ** * ** * ** **
* * * * ** *** * ** *
*** *** * * ** ** *** *
***** * **** *** * * ** * *
   {
* ** *** * * * **** *** * **** ** **
** * * *** * ****** ***** * * * *** *** * * ** ** **** ** ** *
* * * ** **** * ** * ** * **
* *** * *** ** *** * ** ** ****** ***** * * ** ** **** *
   }
* ** ** ** * * **** ****
*** ** ** **** * * *****
*** * * * ******* * * *
* ** ** * * * * * **
* ** ** ** * *** * * * **** * *

* * ****** * ** *** 0;




}
answered by (174 points)
edited by
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
prog.c: In function 'main':
prog.c:8:15: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
     for(j=0;j<strlen(num);j++)
               ^~~~~~
prog.c:8:15: warning: incompatible implicit declaration of built-in function 'strlen'
prog.c:8:15: note: include '<string.h>' or provide a declaration of 'strlen'
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
* ** ** * * * ** *
int main()
{
* ** ** ** char num[1000] = {0};
**** * * ** int k,a=0,b=0;
* **** * *** * *
* ***** ** ** ***** * ***
** * ** * {
***** *** ** * * * * *** *
** * * * * * ** * * * * * *
* *** * * ***
    * ***** * ** else
* * * * ** * * * * * * *
** * * *** }
* * * **
* * *
**** * ******
**** ** * ** * *** * *** * ** * ** * *
** ** ** * else
** * ** * * * **** * * * * * ** * *
*** * * ** *
* *** ** return *** ** * ** **
}
answered by (160 points)
0 0
prog.c: In function 'main':
prog.c:6:2: warning: 'gets' is deprecated [-Wdeprecated-declarations]
  gets(num);
  ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/ccdBSinu.o: In function `main':
prog.c:(.text+0x50): warning: the `gets' function is dangerous and should not be used.
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    char str[1000];

* *** * ** ** * ** ******* * **** * * * ** **
    {
**** *** * * * ** * ** * * * * * *** **** * len,i,j,odd=0,even=0,sum=0;
*** ** * * *** ** *** ***** * * * * * *
        {
*** *** ** * * ** *** * * ** * * ** * ******* ** *** * * ** * ** **
* **** *** * * **** ** ** ** ** * ** * **** ** * * *** ** * * **** **** * *
**** ***** * * *** * * * * ** * * * * * *** * ** * * *** *
* *** * ** * * * * * ** *** ** *** * * ** * * * * * *** * ** * * * * ** * * ** * ** *
* * ****** * * ** *** ** * ** *** * * ** *** *
* ******* ******** * ** ** * ***** ** * * * **** * ** * * * * * ** ** ****
* ** ** * * *** ** * ** * * ** ** * * ** ** * ***
* * * * * ** ** ****** ** ************ ** ** * ** * * * * ** * ** * * **** ******
* * ***** ** * **** *** *** ****** *** *** * **
* * * * * * * * ** * * *** * ** ** * * * * * * * ** * * ** ** * *** ******
** * * * * * * ** * * * **** ** ** ***** * *** * * * ** * * *** * ** **** ** * **** * *** * * * **
** *** ***** * * * ** * ***** ** ***** * *
    }

    return 0;
}
answered
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main(){
** *** ** * ** ** ch[1000];
    int one=0,two=0,i,n,ans;
* * *** ***** ** * * * * *** * *** ** ****
    
* ** * * *** *** ** * * *
    {}
    
* ** ** **** ** * * **
    {
* * * * *** ** * *** * * ** * ** ** **
*** * ** * * * *** ** * * **** ** *
** ** * *** * * *** * * * ** **** **** * * ***** * ** *
** ** * ***** * ** * * * * * * ** **** ** * ***** * ** *** * *
***** ** *** * ** ** * * ** * * * ** **
** ** ***** * **** *** *** * * ** * * *
* * * * ** * * * ***** **** * ** * ** * *** ** * * * ***
* * * * ***** * * * ** * **** * * * * *
* * *** * ** ****** ***** * *** * * ** * *
    }
* ** ***** * *** * ** ** *** * *
* * * * * * * *** ** * * ** * ** * ** *
* **** **** **** *********** * *** ** * **
** *** ** * ** * *** ** *
*** * * * * * ** * **** * ***
** ** ** ***** ** ** ***
*** ** * ** * * ** ***** * *** ** **
    
* *** *** *** * ** ******* ** * * *
}
answered by (192 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.131.184
©2016-2024

Related questions

2 like 0 dislike
8 answers
[Normal] Coding (C) - asked Dec 20, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38155 - Available when: Unlimited - Due to: Unlimited
| 558 views
2 like 0 dislike
5 answers
[Normal] Essay (Open question) - asked Dec 20, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38147 - Available when: Unlimited - Due to: Unlimited
| 249 views
8 like 0 dislike
19 answers
[Exam] asked Dec 8, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 36178 - Available when: 2017-12-08 18:30 - Due to: Unlimited
| 1.4k views
2 like 0 dislike
7 answers
[Normal] Coding (C) - asked Dec 20, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38159 - Available when: Unlimited - Due to: Unlimited
| 485 views
12,783 questions
183,443 answers
172,219 comments
4,824 users