3 thích 0 k thích
6.4k đã xem

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

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

 

輸入說明:

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

 

輸出說明:

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

 

輸入範例:
 

11111111111111111111111111111111111111111111111111



 

輸出範例:

 

YES
[Exam] đã hỏi trong 2017-1 程式設計(一)AD bởi (30k điểm)
ID: 38939 - Xem được từ: 2017-12-23 09:00 - Hiệu lực đến: 2017-12-23 12:10
| 6.4k đã xem

16 Trả lời

0 thích 0 k thích
Hidden content!
#include<stdio.h>

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

*** * * * ******** 0;
}
trả lời bởi (164 điểm)
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 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
* *** *** *** ** ch[1000]={0};
** * ****** ***** ** b,even, odd;
* ** * * ** * * ** * ** ** * ** * ** *
* * * * * * **** * * * ** * **
**** * * * (b=0;b!='\0';b++)
   {
***** * *** ** ** * * * * * ** ** ***
****** * ** *** * * * * * * *
**** * **** *** ****** ******* ** * **** ** * ** **
**** * ** * * * * **** **
** * * * * * * * * * * ** ***** * * * **** **** *** * ****** *
** * ** * * ***** ** ** ** ** * ** * * ** * *
** ** * ** * *** * *** ** * * * * ** * * *** ** * * * * * * ** * *
* ***** * * ** * * *** * ****** ***** * * ** ******** ****

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

}
trả lời bởi (162 điểm)
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 thích 0 k thích
Hidden content!
#include<stdio.h>

int main(void){
** *** ** ** ** arr[1000];
   int even=0,odd=0,i,n,sum;
* *** * **** * * * ** *** *
* * * ** *** *** *** *** *****
*** ** * * ** *** * ** *** * *
** **** **** ***** * * *
* * **** * ** * ***** ** ** ** * ** *
** * * *** * *** ** * *** ** * * * * * ** ** * *
***** *** ** ** ****** *** *** ** **
** ***** ** * *** ** **** * ** * ** * * ** ********* ** *
   }
**** * ** ** *****
* * * * *** ** * ***
* * * ** ** * ** ** * **** *
* *** *** * *** * * *
*** *** ** ** ***** * * ** * * * *
  
** * ** * ** * ** 0;
}
trả lời bởi (131 điểm)
đã sửa bởi
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 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
    int n;
    int a[1000];
    scanf("%d",&a[n]);
    if(a[n]%11==0)
    {
** * * ** *** *** *** * * * * ******* *** * * * *** * * * * * * * * ***** * ****** *** ********* * *** ****
* * * * * ** * * ** * * * * * *** * * ** *** * * * * ** *** * ** ** * ** ** ** **** * * *****
** *** * * * * ** * ** * ** ***** ** * * ****** ** * * **** * * ***** * **** ****** * ******* **** * * *
*** * ** * * * * ** * * *** ****** **** ** ** *** * * ** ** * **** * * ** * * * * **** *
* ** * * * ** * * * * * ** * * * *** ***** ** * *** * * * ******* ** * ** * ** * ** ** * * * * * ** ** * * * ** * * *** **
* * *** *** * *** * * * ** * * *** * * ***** * ** * *** ******** * * ** * ** *** ** * ****** * **** ** * * **
**** ** * * ** * * * * * * * ***** ****** * ********* * * ** ** * ** ** *** *** * * **** ********** ** ** *** ***** * 0;
* * *** * * * * * ** * * *** ***** ********* *** * * *** ** ***** **** ** * * * * * * *** ** *** * ** * ** * * **** * * *
trả lời bởi (190 điểm)
đã sửa bởi
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 thích 0 k thích
Hidden content!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
** * * *** * *** **** * ** * i,j,odd=0,even=0;
* ** * *** ** *** ** ** * * str[1000];
* * ** * * *** ** ******* * **** ** * *
* * * ** *** * *** **** * **
* * **** **** * **** * * ** * *********** 0;
** * ** * * ***** * ** * * ** *
****** ***** ***** *** ***
* * *** * ** ** ** * ****** *** * * ** * *
* * * * **** ***
* * **** * * * * * * **** ** *** ********* *
    {
** * ** ** * ** * * * ** *** *** ******* * * *
    }
* * * * * ***** ** * * * * ** ** ** *** ** ** *
* *** * *** ** *** * ********* * * * *** * * **** ***
***** * **** * ** **
*** *** *** * * * ******* ** **** *** * * * **
* ** *** * *** ** *** * * ** ***** ** *** *
* *** *** *** 0;
}
trả lời bởi (114 điểm)
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 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
* * ** **** * * * ** n,k,a=0,b=0;
* * ******* *** ** * num[10000];
*** * ******* ** **** * *** * *
* * ** ******** * * * * **
    {

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

    }

** * ** * ** * ** ** * *** * **
* * **** * * * *** * * *** ** ** * *** *** ** * * * *****
** ** **** ** * ** * * * * * * **
** ** * * * ** * *** *** ***** * ** * * *** * **** * ******* *** *
 return 0;
}
trả lời bởi (236 điểm)
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 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
    int k,a,b;
* * * * **** * * ** arr[1000]={0};
* *** * ***** * * * * * n,j;
* ***** * * * * * ** * ** *** * *** * *
    
* ** * * * **** ** * * * *
* * * ** **** **** * *
* ** ** * *********** ** *** **** ** arr[k];
*** ** * ***** * ** * ** ***** * **
** *** * *** * ** ***** **
* * * ** * ** * * *** * ** * ;
*** **** * * ** * ** * ** ** * * ** * **** ** * * * ** ** ***** *
    }
    
* ** * *** ** * *** *** * *
**** ** ** ** ** * * ** ** * **** ** **** * ** * *** * * *** *
** ** * *** * ** * ** ***
* * * ** * * ** * ** ******
** ** ** * * * *** * * **** * * * ** ** * * **
* * * *** * * **** * ** ****
* * *** * * ** 0 ;

}
trả lời bởi (194 điểm)
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 thích 0 k thích
Hidden content!
#include<stdio.h>
int main ()
{
   
    int n;
    int a[1000];
    scanf("%d",&a[n]);

** ** * * * * **** * ** * *** ** **** ** ** * * *** *****
** * *** * ****** ***** ** * * * *** ** ***** * * *** *** * * * *** * *
* **** * * * * * * ** * * *** * ** * ** * **** * *** ** * * **
* *** * * * **** * *** ** * *** * ***** ** *** *** ** * *** * ***** *
*** *** ** **** * **** * ** * * * * * ** * ** **** * * *
** * ** *** ** *** * * * **** ****** *********** * * * * * * * * **
** ** *** **** **** * * ** ** * * * * *** * * ** **** * * * * * ** **
* *** * * ***** * * ** * * * *** * ** * *** ** * * * * *** * ** ** ** * * *** ** ****
* * *** ** ** ** ** * * ** * * * * * ** * * ** * ** * * **** ******* * * *
* ** * * * ** *** ** * *** ***** ** ** ** **** **** * * 0;
*** * * **** * * ********* * ****** * *** * ** * *** ** * **** ***
    
* * * *** **** *** * * * ******* ***** * * ** * ** ** * *
}
trả lời bởi (196 điểm)
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 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
* *** * *** * n;
   
* ** ** ** ***** * * * ** **** * &n);
* ** ** * * ***** *
*** * * ** * * * * ** **
* * * * ** *** * * *** *
** *** ** ***** *** **
** ** * ***** ** ** *** **** *
** *** * ******* * *
    
******* ** * * * 0;
}
****** * ** * * ** ***** ** * * *** ** * * * ** * ** *** * ** * ** ** **** * ** * *** ** * * ****** * * ***
trả lời bởi (160 điểm)
đã sửa bởi
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 thích 0 k thích
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)
* * * ** * * * * *** * * ** **** ****** ****
* ** ** * **** * * **** ** * *****
*** ***** *** ** * * **** * * * * * ** * * * * * *** * *
* * *** ** * ** * ** ** * * * **
* *** * ******** **** ** *** ** * ** ** * *** **
** * * * ** * *** ****** ** *** *
    
}
trả lời bởi (172 điểm)
đã sửa bởi
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.69.130.46
©2016-2025

Những câu hỏi liên quan

2 thích 0 k thích
5 trả lời
[Exam] đã hỏi ngày 23 tháng 12 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 38942 - Xem được từ: 2017-12-23 09:00 - Hiệu lực đến: 2017-12-23 12:10
| 2.2k đã xem
2 thích 0 k thích
18 trả lời
[Exam] đã hỏi ngày 23 tháng 12 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 38941 - Xem được từ: 2017-12-23 09:00 - Hiệu lực đến: 2017-12-23 12:10
| 6k đã xem
4 thích 0 k thích
16 trả lời
[Exam] đã hỏi ngày 23 tháng 12 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 38940 - Xem được từ: 2017-12-23 09:00 - Hiệu lực đến: 2017-12-23 12:10
| 9.3k đã xem
3 thích 0 k thích
12 trả lời
[Exam] đã hỏi ngày 23 tháng 12 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 38938 - Xem được từ: 2017-12-23 09:00 - Hiệu lực đến: 2017-12-23 12:10
| 4.5k đã xem
2 thích 0 k thích
3 trả lời
[Normal] Coding (C) - đã hỏi ngày 20 tháng 12 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 38168 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 1.3k đã xem
12,783 câu hỏi
183,442 trả lời
172,219 bình luận
4,824 thành viên