3 喜歡 0 不喜歡
11k 瀏覽

Write a program that asks the user to type an integer N and find out all the factors of N and display it on screen.

寫一個程式 輸入一個整數N,找出N的所有因數

Example input 1

10

Example output 1

1 2 5 10

Example input 2

24

Example output 2

1 2 3 4 6 8 12 24

 

[考試] 最新提問 分類:Midterm | 用戶: (12.1k 分)
ID: 32709 - 從幾時開始: 2017-11-15 14:10 - 到幾時結束: 無限制
| 11k 瀏覽

47 個回答

0 喜歡 0 不喜歡
內容已隱藏
#include * * * * ** **
#include * * ** * ** *

int main()
{
** *** * ** * ******** a,i,c=0;
** * * * * ****** ** ** * * * * * *** ****
* * * * * * ** * * ** * ***
* ** * ** *
* * * * *********** *   if(a%i==0)
******* ** **** * *   {
***   ** * **** * *
* ***** *** * * * ** * ** ****
* **   ** * ** * * *   * * *** * ***** **
***   ** ** * * * * ** ** * * ** *   c++;
**   * * * * **
**** * *** ***** * **
***   ***** ** * * * ****
** * ** * }
* * ** * *** * * * *
** ** *** * * *
***** * * ** 0;
}
最新回答 用戶: (-258 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
int main()
{
** **** * * * ** ****** * b;
** * * * * ** * *** * a;
* * ** ** * *** *** *** * *** * * **** * **** &a);
* *** * ** * ****** *** (b=1; b<=a; b++)
* *** *** * * * * (a%b==0)
* *** ** * * * * *** **
** *** * ***** * ******** * ** * ** * ****** * * * *** *
****** **** ***** *** * ** * * * * ** * * (b!=a)
****** * ** * ** ** * * ** * * * ***** * * ** * * *** *** * ** ");


** ** ** ***** * *
return 0;
}
最新回答 用戶: (-140 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
int main()
{
* ** *** * * * ** **** * n;
** ** ** * * ** ** a;
*** *** * * **** * * *** * ***** * ** &n);


** ** ** * *** *** (a=1; n<=a; a++)



*** * * * * ******** * **** **** (n%a==0)
* * ** * * * * * * *
* * * **** *** *** ** * * * **** ** * * * *** * * ** * a);
*** * *** * * * * ** ** * * * * ***** * * (a!=n)
** **** * **** * ******* * * ** * * **** ** * **** ** * * ********* * ** * * * ");


** * ** * ** * **
return 0;
}
最新回答 用戶: (-140 分)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include * * ** *** ** ****
int main(){
* * * * ******* ** * * n,i;
*** * * * ** ** * *** * *** ** * **** **
** **** ** *** * **** * *
** ***** *** * * * **** ** ** ***** ** *** *** (n%i==0) * ** %d",i);}
return 0;

}
90/100 最新回答 用戶: (-32 分)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
*** * ** * ** *


int * **
{
int * *
* ** *** 1 * * * ****
** ** ** * * * *

* * ***** ** **
{
d=a%c
if (d=0)
* *** *** ****** * * * ** *** ****
}
* * 0;
}
最新回答 用戶: (-32 分)
0 0
prog.c: In function 'main':
prog.c:13:1: error: expected ';' before 'if'
 if (d=0)
 ^~
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
int main(void){
    int n,i;
** ** **** * * **** * * ** ** * *** **
    for(i=1;i<=n;i++)
**** * ** * * *** ** ***** ****** ** * ***** (n%i==0)
** ** *********** * *** ******* ** * ** * *
* *** ** **** * * * **** *** **** ** * * * * ** ** * * *** * * * ** * ** *** * ** *
* * *** * ** * **** * * ** ** **
** * * ***** * * ** ** ** ** ***** * * *** **
******* * *** *** * *** * * ** * ** *
** ** * ** * *** * * ***** * * * ** * * * ***** ** *** *** ** ** ** * * * ** ** ");
**** * ***** **** * * **** * *** *** * **
* * * *** ** ***** * ****** ** * ***


return 0;

}
最新回答 用戶: (-32 分)
0 0
prog.c: In function 'main':
prog.c:4:13: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
     scanf("%d",n);
             ^
0 喜歡 0 不喜歡
內容已隱藏
** * ** * ******
int main()
{
  int a, b, i;
  
**** *** ** * ** * &a,&b);
  
  for(i=1; 1<b; i++);{
* * ** * ** ** ** ** ****
* * * * ** * ** * * ** * ***
*** *** *** * * *
** * * * * * ** * * * * ** ******* ** * * * *** * * *
* ** * * * * *** ** * ** **
* *** * * ****** * * * * * * * * * **
*** * * * *** ******* * * ** *** * *
* * ** ** ** ***** * * **** * **
* * * * ** * * * *** ** * ** ** * * ** 0;
*** ** * * ** *** ****
* * ***** ** * *
最新回答 用戶: (-167 分)
0 0
prog.c: In function 'main':
prog.c:10:13: error: lvalue required as left operand of assignment
     if(a%i+1=0){
             ^
prog.c:14:7: error: expected '}' before 'else'
       else{
       ^~~~
prog.c:18:5: error: expected declaration or statement at end of input
     }
     ^
0 喜歡 0 不喜歡
內容已隱藏
* * ** * * * ** *
int main()
{
** * * ** a, b, i;
* *** *
** * * * * *** * *** * ** * **** ** * *
* * ** ** **
* ** ** ******** 1<b; i++);{
* * * * **** * * * **
* ** * ** * ** *****
**** * *** * ** *
  
最新回答 用戶: (-167 分)
0 0
prog.c: In function 'main':
prog.c:10:5: error: expected expression at end of input
     if(
     ^~
prog.c:10:5: error: expected declaration or statement at end of input
prog.c:10:5: error: expected declaration or statement at end of input
0 喜歡 0 不喜歡
內容已隱藏
#include * * *** ** * * *
int main()
{
* ** * ** ** ** a,b;
* **** * *** * * ** ***** * * *** * * * * **
** * * * ** * * *** ****** * * * ** 2 5 * * ** *
* *** * ** * **** 0;



}
最新回答 用戶: (42 分)
0 0
prog.c: In function 'main':
prog.c:6:10: warning: too many arguments for format [-Wformat-extra-args]
    scanf("number",&a);
          ^~~~~~~~
prog.c:7:11: warning: too many arguments for format [-Wformat-extra-args]
    printf("1 2 5 10",a);
           ^~~~~~~~~~
0 喜歡 0 不喜歡
內容已隱藏
* *** * * *

**** * main()
{
****** ** * * * **** * * * a,b;
** *** * * * ***
for (b=1; ** ***
** ** *** * ***** * ** ** * * (a%b==0)
{
* * * *** ** **** **** *** *** * *** *


if (b!=a)
*** ***** **** * * * *** *** ** * ***** ** *** *

}
return 0;
}
最新回答 用戶: (-254 分)
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:104.23.197.64
©2016-2026

相關問題

0 喜歡 0 不喜歡
21 回答
[考試] 最新提問 12月 9, 2017 分類:Midterm | 用戶: thopd (12.1k 分)
ID: 36754 - 從幾時開始: 2017-11-15 14:10 - 到幾時結束: 無限制
| 6.4k 瀏覽
0 喜歡 0 不喜歡
72 回答
[練習] Coding (C) - 最新提問 11月 2, 2017 分類:Chapter 6: Loops | 用戶: semicolon (5.2k 分)
ID: 29831 - 從幾時開始: 2017-11-02 18:00 - 到幾時結束: 無限制
| 16.4k 瀏覽
0 喜歡 0 不喜歡
22 回答
[考試] 最新提問 12月 9, 2017 分類:Midterm | 用戶: thopd (12.1k 分)
ID: 36753 - 從幾時開始: 2017-11-15 14:10 - 到幾時結束: 無限制
| 6.6k 瀏覽
0 喜歡 0 不喜歡
10 回答
[考試] 最新提問 12月 9, 2017 分類:Midterm | 用戶: thopd (12.1k 分)
ID: 36752 - 從幾時開始: 2017-11-15 14:10 - 到幾時結束: 無限制
| 3.9k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶