3 like 0 dislike
9.5k 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
| 9.5k views

47 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
    int N,i,count = 0;
****** * * * **** * * ** * *** * * * ** *
*** * ** ** **** ***** * * ** * *
    {
* * * ** ** ***** *** ** ***** * *** *** ** * **
** * * ** * ** *** **** ** * ** ** *** * *
** * ** * * ****** ***** * ** * * *** * ** * ** **** *** ******
* ** * * ** * * ** ** * * ** * ** * ** ** **
* ****** *** * * * * ***** ** * ** *** ** ** *** ** ***** * * * **** * ** ** * *
* *** ** * * **** ** * * * * ** * ***** ** ****** *** ** * * * * **
** * * ** ** * * * * * * * * *** * * ** ****** * ** * *** ** ** ****
* **** * * * ** *** * * * * **** * ** * * ** ** * *
**** * * *** * **** * * * ** ** ** * * * * ** ** * *** * * * * * * * ** ** * * ******* * **** ** **** %d",i);
* * *** ***** * * * * * ** *** ** *** **** ****

    }
    return 0;

}
answered
reshown by
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()
{
    int a,b,s=1;
*** ** **** *** ** *** * * * ** ** *** **
    for(b=1;b<=a;b++)
    {
** * * *** * * * * * * *** **** * * * ** *
**** * * **** * * ** * * ****** * **
* ** ** * *** * ***** * * **** ** * *** *   for(s=0;s<=a;s++)
** ** ** * ** ** **** ** ** * * * * ** * * * ** * ** * *
*** ******* * * ** *** ** * * * * ** *** * *** ** ** * * * * * * * * ** **** *
****** * * * ** * ** *** * * * *** *** *** *** ** * * ** *** **** * ** * * * ** * ** **
* * ** ** ***** ******* *** ****** ** *** * * ** * * * * ** *** * * ** ***** * *** ***** * **** **** **
* ** *** * ** * ** * *** * *** * ** * ** *** * ** * ****** ***** * ** ** ***** * * *
***** ***** * * * * ** * * * * ** *** *** * * * *** * *** ** * * * ** * * ** * * if(s!=1 && b!=1)
* *** ** * * * ** *** * * * * * *** * * * * ** * ** ** *** * * ** ** ***** ** * * *** *
*** ** ***** * ** ** * * * * * * ****** * ** * ** * **** *** * * ** ** **** ****** * ** ** * %d",b);
* * * *** *** * ** * ** ** * * * ** * ** **** ** * * *** * ** * * * **** * ** *
**** * * * * * * **** * * ** **** * ** * * ** ** * * ** * * * * * * *** *** ** *
* ** * ***** ***** * ** ** * ****** ** ****** **** * ** * * *** ***
        }
    }




    return 0;

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

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

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

** ** * * * * **** * * * i<=n; i++)
* *** ***** ** * *
* * * * * ***** * *** * * ***** **** ***** **
*** ** ***** ** * **** * *** ** * ** * *** * * *** ** * * ***** ** * * * ", i);
* * * ** ** ***** *
* ***** ** ** ** **** * * ** * * 0;
}
90/100 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 *** ***** * *
#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 ** * ****
int main (){
int i,n;
* *** * * you number: ");
**** * * **** *
* **** ** **
***** ** **** ** * *
** ** * * * ****** * * ***** *** ** **
** * ** * * ** ** * * * * * ** * ***
}
** * * *** ** ** ** *
return 0;
}
answered by (90 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()
{
    int n,i,c=0,a;
**** * ** *** * * * ** * *
    for(i=1;i<=n;i++){
**** * *** * * * * ** * * *** * * *** ** *** **
* ***** ** * ** * * * * * * **** **** **
* * * ** * *** * * ** ** ** *** * ** * * ** * ** * ****
** ** ** * *** ** ** * ** * * * ***** ** ** * * * * *** * * * * * ***** **** ** * *** * * *
* * * * * * * * *** ** * * ** * * *** ** * * *** * * * * * **** *
** * ** **** * * * ** ** ** * ** ** * ** * * * * ***
* * *** * * **** * * ***** **** * * * * *** * ** * ** * *
****** ** * *** * * ** *** * ** * *** ** *** ** ** ** * ** * * * ** * ** ** * *** *** %d",i);
*** ** * * ** ** * * * *** * ** * * * *** **** * * * ***
** * ** * * * * * * * *** * * * * **
    }
    return 0;
}
answered by (54 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>
//factors of N
int main(void)
{
* *** * ** *** i, n;
* * * **** * ** * ** * * * * * ******* &n);

* **** *** ** ** *** i<=n; i++)
* * * **** ** * **
** * * ** ** ** **** ** * **** * * **
** ***** ******* * ****** *** * * * * ** ** *** * * *

** **** ** * ** * ** * * * * ** ** * * * * * *** **
* * *** *** ** ** *** ** ** *** * * * ****** * ");
******** * * **

*** * *** **** ** * * 0;
}
answered by (-304 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()
{
    int n,i,c=0;
    //input
** * ** * * * *** * *** ******* * * * *** *
    for(i=1;i<=n;i++)
    {
* **** ** * * **** * ***** *** *** ** * ** of a Number
**** ***** ** *** ** *** ** * * * ** ***** * * ** *
* ** ** * ** * * * ** * ** * * *
* * ** * * * * *** ** * * * * ** * **** * ** ***** ** *** ** * ** * **
* * ** ***** **** ** * ** ** * **** * * ** * * * * ***** ***** *** ******* * ***
* * * ** *** * * ** * * ** * ** ******** *** * * * *** ** * ** *** ***** *
* * **** **** *** * * ** **** * **** * * *** * * * * ***** ** **** ** ** ** *** * * * ******** * ** * * *
*** **** **** ** * ** ** **** **** * * *** * * * * ** * **** * * ** ** **** * *
* * ** ** * ***** ** * * * * * * * * ** *** *** *** *
** ** ** * * ** * * * ** *** * ***** *** * **** *** ** ** ** * ** ** *
* *** * ** ** *** * **** * ** ** ** ** * ** * ** ** *** **** * *** **
***** * ** * *** ***** **** **** ** * ** * * ** * * * ** ** **** ******* *** ** * * ** ** * * * *** %d",i);
******** * * * * * *** ** * **** * ***** * *** *** ****** * * *
* * * *** *** *** ** *** ** ** ** * *** * ** **
    }
    return 0;
}
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<stdio.h>

int main(){

** * * * * * * *** * **** a,b=0,i;

** * *** * * * *** ** ** *** *** **** *
****** *** *** *** ** ** * **
* ** * *** * * * **
* *** * ******* * * * * *** * * ***
* *** * * ** ** *** *** *** * ** *** ** *** * * * ******* * * ***** **
** **** ** *** * **** **
* *** ** ** ** ** * *** * ** * ** *
*** * *** * * **** * * {if(a%i==0)printf(" %d",i);}

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


return 0;
}
answered by (-301 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()

{
    int N,i,j,flag,count=0;
    scanf("%d",&N);

    for (i=1;i<=N;i++)
    {
*** *** * * *** * * * ** * * *** **** ** ** *
*** ** ** * **** ** *** * * * * * * * * ****** * * **** ** *** * *** (flag==0)
* *** ** *** * * ** * ********** ** *** * *** * *** * * * **** ** **
*** * * * * * *** * * ****** ** * *** **** ***** *** * * * * * * ** ** ** * *** ******* * ** **
** * * * * * *** * * *** * ** ****** * ***** * ** * * * * ** * * ****** ** * (count==1)
*** * ** ** ***** *** * ****** **** **** ** * ** ** * **** ** **** *** * ** ** *
*** ****** ** * ** * *** *** * * * **** ** ** * * * * * *** ** ** ** * * * **** * * * * * ** * *** ** ** * *** * * * * *** * * **
* * * *** * * *** * ******* **** *** * *** **** ** * * * ** * * * *** * * * ** * ** **
** * *** **** * * ** ** * ** *** *** * ** * * * * ** ** * ** *** * * * *** * * * *** * * **
*** * ** * **** **** * * ** ** *** * *** *** * * ** ** * * ** ** * * * ** *** *
*** * ** ** *** *** ** * * ** * * * * ** * ** ****** ** * ** ** * ** * ***** * * * * * **** ** ** * %d",i);
* * * *** *** * * ** **** * ** * * * ** ** *** * * ** * * * * ***** *** ** * ****** *
**** * ******* * * ** ***** * *** **** *** * ** * *
    }

    return 0;

}
answered by (-249 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:172.69.214.205
©2016-2025

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
| 5.6k 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
| 14.4k 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
| 5.7k 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.4k views
12,783 questions
183,442 answers
172,219 comments
4,824 users