3 like 0 dislike
10.9k views

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

 

[Exam] asked in Midterm by (12.1k points)
ID: 32709 - Available when: 2017-11-15 14:10 - Due to: Unlimited
| 10.9k views

47 Answers

0 like 0 dislike
Hidden content!
* * ****** * ** * **
main ()
{int a,b;
* ** * * ** * ** *
for (b=1; ** * *
****** * * ** ***** ***
{
* * ** * ** * ** ** **** ** * * * * * **


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

}
*** 0;
}
answered by (-254 points)
0 0
prog.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int]
 main ()
 ^~~~
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main(void)
{
** * * * * * * * n,i;
* ** *** ** * ** ** **** ** * **** ***

* * * ** * * * * ***** *
    {
** ** * * * ***** * * ** * *** * ** ***
*** * * * * *** ***** * ** * *** * * ***** **
* *** ** * * * ** * ** * * * * ****** ** && n>i)
** * * * **** ** *** * ******** ** * **** * ** * ********* ***** *** ** * * ** ** ");

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

* * ** ** **** * * *** * 0;
}
answered by (-249 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 (void)
{
    int i,d,b;
    b=0;
* * * *** * * **** *** ** *
    for(i=1;i<=d;i++)
    {
* ** * * * *** ** ** * * * * ** * (d%i==0)
* * * ** * * * ** ***** * ** *** * * *
* * *** ** *** ** **** *** * * ** * *** * ** ** *** ** * * * * *** * ** (b==0)
** *** * * ** * *** ** * * * * ***** ***
*** ****** ***** * * * ***** ** ** * ** *** * ** * ** *** ** * * * ** *
* ** * * *** ** * * **** * * * *****
* ** ** * * * * * ** * **** *** * * * * *** ** (b>0)
***** ** * * * * ** * * * * ******* *
* * *** *** * * * *** ** *** * * ** * * *** * ** * ** * %d",i);
*** ******* ***** ***** * ** * ***** * * ***
** * **** ** ** *** ** ** * *** **
** * * **** * ** ** ** * * * * * * *** * * ** * **********
* ** * * ** **** * * **** ** * ** **** *** *
** **** * ****** * * * * **** * * * *** 0;
}
answered by (-168 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(void)
{
*** * * * * * * n,i;
* * * * ** *** * **** *** *** * *

* ** *** *** * * * * ** ** **** *** **
    {
* * ** ** ** * ** * ** * ** * *
** * * * * * * * * ** *** * * ** *** ***** *** * *** *
* *** **** ** * *** ** ******** **** ** * && n>i)
* * ******** * * *** *** * * * * * * *** * ** ***** * ***** * * * * *

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

*** * * ***** *** * * *** 0;
}
answered by (-249 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main (void)
{
** * *** * * * ****** i,d;
******* * * * **** * * * **** *** * ***
* *** * ** * ** **** * ** * * *
** * * ** *** ** *
****** * * ** * ** *** * * ** * * ***** (d%i==0)
***** ** ** *** * *** ****** ***
* * * ** ** * ** ** ** * * * * * ** *** *** * ** *** * ** * * ** * *** ",i);
* * ** ** * *** **** ** ** * ** * * * *
    }
}
answered by (-168 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include ** * * ** * ****
int main(void)
{
* ** * ** * *** * *** num,j;
* ***   * **** * * ******** ** **

**** *   * ** **** ** * *** ** *** * * ** ** j++)
* *** *   **** ** ** *** * * ** * *** ** ****** * *** *****
*       * * * * ** ** ** *** * *** *** * * ** ** **** **** *


** *     * {
**   *** * * * * * * *** * **** ** ** * ** *** * ** * * ** * * * * ******** * * * * *
* * * * ** * ***** }
* * * *     ***** * * * ** ** ***** * * *** * ** *** * * *****

** *       {
***** ** * * * ** * * * * *** *** **** ** * * *** * * * * *** * * ********* ** *** * * *
* * * ** ** * * * *** * * * * * *** ***
* * ****   }
}
answered by (323 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 * ** * * *
#include ** * ** **

int main()
{
** * ***** ** * *** ** ** * a,b,c,d,e;
** * * * * *** * ** ***** **** ****** **** **
* * *** * ******** ** ****
* ** * * ** * * **
** * * * *** *** *
******** * ** * ** **
* * * * * *** *** ** * * * * * %d %d %d",e,d,c,b);
*** * * * * * * * * ** * * 0;
}
answered
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main()
{
*** ** * ** * ** * * a,b,c,d,e,f,g,h;
* ** * * * ** ****** * ** *** * *
* * * ** *** * **
** ** * **** ** * * * *
* ***** ** ** * ** * * **
* *** * *** * ** * ** *
** * * **** * * * * *
* * * ** ** * ** * * ** * *
* * ** * * **** * ***
** * * * ** ****** * * ** * ** %d %d %d %d %d * ** ** * *
* ** * ***** * *** ***** 0;
}
answered
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>
int n,i;

int main(){
* * * * ** **** * * * ** **** ***** ** *
**** * * ** * * ** ** ** *** *
** ****** * ** * ** * * *** * ** ** * *** * ******* * ** **
* ****** ** ** * * ******* *** * *** * ** ** * **** **** ");}
** ** ** * ** * ** *
** *** *** * *** 0;
}
answered by (-286 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 a,i,k=0;

int main()
{
** * **** * * *** * * **

for(i=1;i<=a;i++)

  {
** *** *** * * * * ** *
* ** * * **** *** * ** ** **** * *** **
** *** * * * ****** * ** ********** ** *** ****
* *** * * ** ** *** **** * * ** *** ** * *
* * ** ******** ****** * ** ** * ** * * * *** ** *** **** * * * **** *
*** * * ** * * *** ** ** * * ** ** *** *** * * * *
* ** * * * * * * * **** ** ** ** **** * * * * * * * * %d",i);}

* * * * * ** **** * * * ** * * * * **
  }
}
answered by (-336 points)
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.243.165
©2016-2026

Related questions

0 like 0 dislike
21 answers
[Exam] asked Dec 9, 2017 in Midterm by thopd (12.1k points)
ID: 36754 - Available when: 2017-11-15 14:10 - Due to: Unlimited
| 6.3k views
0 like 0 dislike
72 answers
[Exercise] Coding (C) - asked Nov 2, 2017 in Chapter 6: Loops by semicolon (5.2k points)
ID: 29831 - Available when: 2017-11-02 18:00 - Due to: Unlimited
| 15.9k views
0 like 0 dislike
22 answers
[Exam] asked Dec 9, 2017 in Midterm by thopd (12.1k points)
ID: 36753 - Available when: 2017-11-15 14:10 - Due to: Unlimited
| 6.5k views
0 like 0 dislike
10 answers
[Exam] asked Dec 9, 2017 in Midterm by thopd (12.1k points)
ID: 36752 - Available when: 2017-11-15 14:10 - Due to: Unlimited
| 3.8k views
12,783 questions
183,442 answers
172,219 comments
4,824 users