3 like 0 dislike
6.4k views

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

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

 

輸入說明:

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

 

輸出說明:

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

 

輸入範例:
 

11111111111111111111111111111111111111111111111111



 

輸出範例:

 

YES
[Exam] asked in 2017-1 程式設計(一)AD by (30k points)
ID: 38939 - Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 6.4k views

16 Answers

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

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

*** * **** * *** * 0;
}
answered by (164 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
Case 6: Correct output
Case 7: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
* * ** *** *** * ch[1000]={0};
* * * * **** * * b,even, odd;
*** * *** * * * ***** * * *** ** *** ***
* * * * * **** * *** * ****
* *** **** * *** (b=0;b!='\0';b++)
   {
* * ** * ** * ** * ** ** *** ** ** * ** ****
* * ** **** * * *** * * **
** * * * * * * *** * * * * *** * **** * * *** *** **** * * *
*** ** * ** ** ** ** ** ******
*** * ** * * * * * * *** ** ** * *** * ** ******* * * *
*** * ** **** * * ***** * * * * *
* ** ** *** * * ** * ** ** * *** ****** ** * * ****** * ** *
* * *** *** * * ** ** * * *** ** ** * * *** * *

   }
* *** ** * **** ** * * *
* * * ** * ** * *
* * * * * * * * *** * *** * * * **
   }
***** ***** ** ***** *
   {
* * * **** * ** * ** * * ** *** * **
   }
** * * * ** * 0;

}
answered by (162 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Case 5: Wrong output
Case 6: Wrong output
Case 7: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main(void){
*** ** ***** ** * * arr[1000];
   int even=0,odd=0,i,n,sum;
* * ** ** **** * * * ** * * ******
*** ** * **** **** * ** * *
*** * ** * * * ** * * * * ** * * * * *** **
* ******** * * ** * * * *
*** ***** **** * ** **** * *** * **
** *** ** * **** * ** * ** * * * ** * ** * * *
***** *** **** ** * * ** * ** **
*** * * * * ** * * ** * ***** **** ********* *** * * ** *
   }
****** * * ** ** ***
**** * * ***** * * * **
* ** ** ******** ** * *
** *** ** **** ** * ****
* * ** ** * ** *** * ****
  
* * *** ** ** 0;
}
answered by (131 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Case 5: Wrong output
Case 6: Wrong output
Case 7: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Case 5: Wrong output
Case 6: Wrong output
Case 7: Wrong output
0 0
prog.c: In function 'main':
prog.c:20:4: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
    system("pause")
    ^~~~~~
prog.c:21:4: error: expected ';' before 'return'
    return 0;
    ^~~~~~
0 0
prog.c: In function 'main':
prog.c:20:4: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
    system("pause");
    ^~~~~~
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
Case 6: Correct output
Case 7: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int n;
    int a[1000];
    scanf("%d",&a[n]);
    if(a[n]%11==0)
    {
* * * * * * ********* * *** ** ** * ** *** *** * * ** * ** * * * * * *** **** *** ** * * * ***** *
** *** * ** * ** * * ** * * * * * *** * ** * * ****** * ** ***** * ** ***** ** * ********** ********* **
* ** ***** * * * ****** *** ******* *** *** *** ** *** ** * *** ** ** *** * *** * * *** *** **
* * * ** ** * * * * * * * ******* * ** * * ** * * * *** **** *** * ** * * ** * * ** * * * ** **
* *** *** ***** * ** * ** * * ** *** * * * * ** ** * ** * ** ** * * * ***** ** * * * * ** * * ** ** ** * *** * * * *** * * ** *** * ***
* * **** **** *** *** * * ** * * ** * *** ** * * * *** * ** * ****** * ** *** * * ******** ** ** ** * * *
**** * * * ** *** ** * *** * ** **** ****** * * **** ** * ***** ** ** ** * ***** ** ******* * * ** * ** * * ** ** ** 0;
** * **** ** * * **** * * * ****** * * ** * * * * **** * * **** * * * *** ** * * ** * * ** * *** *
answered by (190 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Case 5: Wrong output
Case 6: Wrong output
Case 7: Wrong output
0 0
prog.c: In function 'main':
prog.c:6:17: error: 'a' undeclared (first use in this function)
     scanf("%d",&a[n]);
                 ^
prog.c:6:17: note: each undeclared identifier is reported only once for each function it appears in
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Case 5: Wrong output
Case 6: Wrong output
Case 7: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Case 5: Wrong output
Case 6: Wrong output
Case 7: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
** * * ** * * ** ** * * ** i,j,odd=0,even=0;
* *** * ** ***** str[1000];
***** **** * * ** ** * *** * ** ** * ** *
** **** ** ******* * * *
** * * * * ** * * * ** *** * * ** ** * ** *** 0;
* * *** * ** **** * ** ** *** * ** ** **
** * * * * ** ** *
*** ** *** **** * ******** * ** **** * *** * ** *** *
** ** * * ** * ** *
** *** ** ** * ** * * ** * ** *
    {
** ****** * ** * * * ** * ** *** ***** ** ****
    }
** * ** ** ** *** * * ***** ****** *****
* *** * * *** * *** * * ** * *** ** *** ******** * * *** ****** *
* *** * ** *** *** * *
**** * ***** ** * * * * * * * ** * ** ** ******* ** ****
* ** *** * * * ** ******* ***** *** ****
******* * *** * ** ***** 0;
}
answered by (114 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
Case 6: Correct output
Case 7: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
* ** ***** **** * * n,k,a=0,b=0;
** **** ** * *** **** * num[10000];
** * * *** ****** **** ** **
* * ***** ** ** * ** * * * * * *
    {

*** * **** * * ** * * * ** ***** * ** ** ** * * * *
*** * * ** ** * * ** ****** ** ** * * * **** * * * * ***
***** * ****** ** *** ** * **** * ** * *** * **
*** * *** * ** * ** * * ***** * * *** ** * * * **** ** * * ** ** *

    }

**** * *** * * * ** * **
* ******* **** ** * ** ** **** * ** ** * * * ** * *
***** * ** * * ** ** *
********* ** * ** * * * ***** ** *** * ** * * **
 return 0;
}
answered by (236 points)
0 0
prog.c: In function 'main':
prog.c:6:5: 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/ccgmKRMg.o: In function `main':
prog.c:(.text+0x39): warning: the `gets' function is dangerous and should not be used.
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int k,a,b;
* * ** **** ** *** arr[1000]={0};
****** * ****** * *** * * n,j;
* * * * * * ** ** *** * * * * * * * * ** * **
    
* ***** ** ***** **** *** *
** * * ***** * * * * * ****
* * * * * **** * * * *** *** * arr[k];
* * ** * **** ****** * **** **
* * * **** * * * *
** * ** * * * ** * *** * ;
*** **** * * ** * *** ** ** * * * *** * *** ** * * * * * * * ** *** * * *
    }
    
* ** *** * ***** * ** ****** * *
* ****** ***** * * * * * * ** ***** *** * ******** * **
** ** ** * * * * * * * * * *
* ** ** ** ** ******** **
** **** * ****** * * * * * ** * * ** ** * *** * **
* * * ****** *** ******
** * * ** * ** * * * ** *** 0 ;

}
answered by (194 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Case 5: Wrong output
Case 6: Wrong output
Case 7: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main ()
{
   
    int n;
    int a[1000];
    scanf("%d",&a[n]);

* **** ***** **** *** * * ****** ********* **** ****
** ** * * * * * * * * ******* ***** ** ** * ** *** ** * * ***** * ** * ** * * ** * * **
** * * * * * * * * * * ** **** * ****** * * ** * * * * * * *** ** **
*** ** **** *** *** * * * ** ** *** ** ***** ** * * ****** ** * ***** * * **** ***
* * * *** **** * ** *** * ** * ** * ** * ********* ** ** * **** *
* * * * * * * *** *** ** * * * *** ** ** * ** * * *** * * * **** *
* ** ***** *** ** * ** *** * * * * **** * ** ****** *** ** * * **
* * * ** * * * ** ** ***** * * ** * **** * * *** ***** **** * ** * **** * * * * * * *
** *** ** ** * * **** *** * * *** ** * * ** * * * ** * * ** ** * ** *
* ** * ** ****** * ** * * *** *** *** *** ****** * * * ** ** ****** * * 0;
** * * * ** ** * *** * * * ** ** * * *** * * * ** * *** *** *
    
* * ***** * * *** * * * * * ** *** ** * **** * ** ** *** * *
}
answered by (196 points)
0 0
prog.c: In function 'main':
prog.c:19:14: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
              system("pause");
              ^~~~~~
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Wrong output
Case 5: Correct output
Case 6: Wrong output
Case 7: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
*** * * *** **** * n;
   
** ** * *** * * ** **** *** * *** &n);
* * * *** ** * * ****
* * * *** * * * * ***
*** ** * * * ***** ** ** * ** * ** ** * * ** * *
*** ** * ** *** *
* * * ** * * * * * ** *** *
*** * * * *
    
** * * * ****** * * * * 0;
}
* ***** * ** * * *** * * * * * *** * ** *** * *** * * ***** *** ******* *** * ** ** * * ** *** * **
answered by (160 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Case 5: Wrong output
Case 6: Wrong output
Case 7: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Case 5: Wrong output
Case 6: Wrong output
Case 7: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Case 5: Wrong output
Case 6: Wrong output
Case 7: Wrong output
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Wrong output
Case 5: Correct output
Case 6: Wrong output
Case 7: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int i,a=0,b=0;
** **** ** * * * * *** arr[1000];
** *** ******* * ** * * * *
* * *** * * * i=0;arr[i]!='\0';i++)
    {
** * * ** * ** * ** ** * *** *** *** ***** ** * * * ** **
* * * * * * * * *** * * ** * * ****** * * * ** *********** **
*** *** ******** **** **** ** ***** * * * * * if(i%2!=0)
* **** ** *** **** ** * * ****** * * * * * * ******* ** ** ** **
    }
* * ***** ** ** * * *
* * *** ** * * ** ** * ****** * * * * *** *
*** ** ** ** * * * * * ***** if (i%2!=0)
* ** *** ** *** * ** *** ** *** ** ** *
* **** * ***** *** ** ** * **
* *** **** * *** *** ** ** ** * ** ** * **** ** * * *
* * * * ** * * ** * * ****
*** ***** * ***** ***** ** ** *** *********** **** *****
**** *** * * *** * ***** * * **** * ** *
    
}
answered by (172 points)
edited by
0 0
prog.c: In function 'main':
prog.c:6:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(arr);
     ^~~~
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/cckn201s.o: In function `main':
prog.c:(.text+0x39): warning: the `gets' function is dangerous and should not be used.
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Case 5: Wrong output
Case 6: Wrong output
Case 7: Wrong output
0 0
prog.c: In function 'main':
prog.c:23:5: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
     system("pause")
     ^~~~~~
prog.c:24:1: error: expected ';' before '}' token
 }
 ^
0 0
prog.c: In function 'main':
prog.c:23:5: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
     system("pause");
     ^~~~~~
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Wrong output
Case 4: Correct output
Case 5: Correct output
Case 6: Wrong output
Case 7: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.80.153
©2016-2025

Related questions

2 like 0 dislike
5 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38942 - Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 2.2k views
2 like 0 dislike
18 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38941 - Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 6k views
4 like 0 dislike
16 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38940 - Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 9.3k views
3 like 0 dislike
12 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38938 - Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 4.5k views
2 like 0 dislike
3 answers
[Normal] Coding (C) - asked Dec 20, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38168 - Available when: Unlimited - Due to: Unlimited
| 1.3k views
12,783 questions
183,442 answers
172,219 comments
4,824 users