3 like 0 dislike

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

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

 

輸入說明:

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

 

輸出說明:

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

 

輸入範例:
 

11111111111111111111111111111111111111111111111111



 

輸出範例:

 

YES
[Exam] asked in 2017-1 程式設計(一)AD by (20.8k points)
Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 118 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 (154 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
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.70.185
©2016-2019

Related questions

2 like 0 dislike
5 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (20.8k points)
Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 23 views
2 like 0 dislike
18 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (20.8k points)
Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 108 views
4 like 0 dislike
16 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (20.8k points)
Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 193 views
3 like 0 dislike
12 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (20.8k points)
Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 56 views
2 like 0 dislike
3 answers
[Normal] Coding (C) - asked Dec 20, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (20.8k points)
Available when: Unlimited - Due to: Unlimited
| 44 views
8,033 questions
60,929 answers
33,033 comments
1,105 users