0 like 0 dislike

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

 

[Exercise] Coding (C) - asked in Chapter 6: Loops by (5.2k points)
Available when: 2017-11-02 18:00 - Due to: Unlimited

edited by | 273 views

72 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int i,n,c=0;

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

    for(i=1;i<=n;i++)
    {
* ** ** * * **** *** *** ** ** ** * * ** ****
* * * * **** ** * * *** * ****** * * ****
** * ****** * * * * * ***** * **** * * **** * * **** *** ** *
** * ** ** ** * * **** *** * *** ** ** *** * ** ****** ****
* * ** * *** * * *** ** *** * *** * * ** * * ** * ****** * **** * * * * ** ***** * *** * * *** * *
** ** ** ** ** ** ****** * * ** *** ** * **** * ** * ** * * * * *** * * *
** ** **** ** **** ** ** * * * * **** ** ** * *** ** * **** ** ** * * ** ** *
* * * *** * *** ****** * * * *** ** *** *** ** * * * **** * * * **** ****
* *** ** **** * ** * * ** *** * * ** * * * ** * *** *** * **
* * ** *** * * *** *** * ** **** * * * ******** ** *** *** ** **** * * * *** ** * %d",i);
** ***** * * ** *** ** * *** * * **** ** * *** * * ** * **
*** * * ** *** ** * **** **** ** *** * * *
    }
    return 0;
}
answered by (-153 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()
{
* * * * ***** a,b;
* * ** *** **** * ** ** ******* ** ** ** **
** *** *** ***** * ** * **** * * * **
**** * * * *** ***** * ***
** ***** * ** ** * ** *
* *** ** ** ******** * ***** * * * * *****
printf(" %d",b);
*** * * * * * ** *
* ** ** *** ** *** * * * * 0;
}
answered by (-108 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 ****** * * **

int main()
{
** * **** * * * ** * n, i;

* * ******** *** *** * * * &n);

*** * * * * * ** * * ** ** = 1; i <= n; ++i)
* *** ** * *** ** * * *
* *** * * * ******* *** ** ** * ** ** * *** * *** % i == 0)
**** ** * ** ** * * * **** * **** ****** ****** * ** *** ** * *** ", i);
** ** ** * *** * * **

*** * * * * ** * * * * * * * *** 0;
}
answered by (-108 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()
{
* *** * ** ** ******* n, i;

* * ** * * * ** * *** ** * &n);

* * * ** ** * * ** = 1; i <= n; ++i)
* ***** * *** ** * * *
* * *** * * *** * * * * ** *** * ** *** * * % i == 0)
*** ** ********** ** *** *** ** * * *** **** **** * *** *** *** * * ** * ", i);
* * * *** * ******* ** ***

******** *** * * *** ** ** 0;
}
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 <stdio.h>
int main()
{
* * ** ** * * * * ** number, i;
* ** **** **** * ** * **
** * **** ** * *** *** * ** ** * ******* **
* * * ** * * * *
*** ** * ** *** * * *** * ** *** ** of %d are: ", number);
* * * * * *** * * * i <= number; ++i)
** * * * ** ** ** * *
* * ******* * ** ** * *** * ** * ** * * * (number%i == 0)
** *** * * * ** ** * * * ********** * *
* * *** ** * *** * * ** * * * ** **** *** ** * * * * ** * ** * * ***** ",i);
* *** **** *** ***** * **** * ** ******
** ** ** * * *** * **
    
** * *** * ** * ** **** 0;
}
answered by (-233 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 (){
int num,i;
** * * * ** number: **** **
****** *** *** **** ** *
* ** * * of %d are ** ** *
*** **
* ** **** *** * * * **** * **
* * * * *** ** ** * * *** * ** * *** * ** **** * ** * * **
* ** * *** * * **** * *
}

return 0;
}
answered by (16 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()
{
** * * ** * ** *** * * ******* a,b;
**** * * **** * *** * * ** ** **** * * * ** ** * * *
**** * * * * * * ** ** * *** *
** ** * * *** * ** * ** * * *** *
* **** ** ** *** **
* * **** **** ** ** *** *** * * * *** * * * * * *
printf(" %d",b);
*** ** * *** ** * * *****
* *** * * * * **** * 0;
}
answered by (-284 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()
{
** * ** * * ** * ** * * a,b;
* * * * * * * ***** ** *** *** **** * * ** *
**** * ***** * * * ** ** * *
* * *** ******* * **** * *
* ** ** *** ** * ******
** * * ** * ** * * * * ****** * * ***
printf(" %d",b);
** ** * *** ** ** ** * **
* ** ** *** ** * ** * * 0;
}
answered by (-32 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!
* ***** ** ** **
int *
{
int n,i;
***** ** * * ****
* **** * *****
{
* ** * *** *** ***** * *
}
}
answered by (-32 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()
{
* * ** * ** ** number, i;
*** ** * * ** ** * ** * * ** * ** * * ** ***** *** * ** * *
** * * * * * **
   
* ** * * * ** **** * *** i <= number; ++i)
*** * ** **** * * ****
*** ** **** * * * *** ** **** *** * ** * (number%i == 0)
* ****** ** * * * * ** *** ** *
***** *** * * ***** * ** *** ****** **** * * * * * * ** ** ** * ",i);
* ** *** **** **** ** * **** * * * * * * * * *
* ** * * ** * ** **** **
** * * *** * * ***
* * * ** **** ** *** **** 0;
}
answered by (323 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong 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.62.16
©2016-2019

Related questions

0 like 0 dislike
99 answers
[Exercise] Coding (C) - asked Nov 2, 2017 in Chapter 6: Loops by semicolon (5.2k points)
Available when: 2017-11-02 18:00 - Due to: Unlimited
| 269 views
1 like 1 dislike
85 answers
[Exercise] Coding (C) - asked Oct 26, 2017 in Chapter 6: Loops by semicolon (5.2k points)
Available when: 2017-10-26 18:00 - Due to: Unlimited
| 180 views
0 like 0 dislike
69 answers
[Exercise] Coding (C) - asked Oct 26, 2017 in Chapter 6: Loops by semicolon (5.2k points)
Available when: 2017-10-26 18:00 - Due to: Unlimited
| 202 views
8,988 questions
76,589 answers
52,405 comments
2,225 users