1 like 1 dislike
4.3k views
Show more...
[Exam] asked in Midterm by (12.1k points)
ID: 32707 - Available when: 2017-11-15 14:10 - Due to: Unlimited

edited by | 4.3k views

36 Answers

0 like 0 dislike
Hidden content!
#include * * ** ***
//gcd and lcm
int main(void)
{
*** ** ** * *** * ** *** n,m,i,gcd, j,k,lcm;
* * ** * * ** ****** * ** **** &n, &m);
* * * * ** * * *** * * i<=n *** * ** i<=m; i++)
* ** * * * ** * ****** **
** * ** * * * *** * * * ** * ** * * * **** * ** ** m%i==0)
* ** * * ** ***** ******* * * * * ** **** * *** * * **** * * ** ***
* ***** * *** *
* ** ** * ** ** ** ** *** ** * ** ** ", gcd);

** * ** ** * * * * k>=n && k>=m; k--)
*** *** ** * ** *** *
* * **** ***** * * * * * ** * * k%m==0)
** * * * * * ** *** * ***
* ** * * *

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


* *** *** ** ** ** 0;

}
answered by (-304 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main() {
*** * * **** ** * a,b,tmp,x,y;
* * *** * *** * ** * * * * %d", &x ,&y);
***** ** * * * ** * *
** ** ** * * *
**** ***** * * *** * * * {
* *** * * * * * ** * **** * * * * * ** ******
*** * * ****** * * ** * * * ** *** *** *
*** * * ** * * ** * ** * **** *** *
* * ***** * * * ** *
* * * ** **** * ** **** ** **** %d", b, b*(x/b)*(y/b));
}
answered by (-120 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main(){
* *** ** ** ** *** ** ***** a,b;
** ** * **** ** ** * * **** gcd,lcm;
** * *** * * *** ******* *** * %d",&a,&b);

** * * ** **** ** * * * ag=a,bg=b;
*** ** **** * * * * * * * ***** **
***** * * ** * * *** * ******* * * * *** **
******* ** * * ** ******* * * ** * *** ** ** * *** *** temp;
******* ** **** * ** ** ** * * *** * * ***** bg=ag, ag=temp;
* *** * ** * *

**** * * * *** * ** * ** * i=1,al=a,bl=b;
* * *** ***** ** * *** * al%bl!=0 ) {
** *** ** * ** * * * ****** * ** * * *
* ** *** *** ***** ** * * * * * * *
* ** * * * *** ** ** *

** * * * *** * **** * **** %d",bg,al);
** ** **** * ** * * ** * ** * 0;
}
answered by (-116 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int a,b,i,q=1;
int main()
{
scanf("%d",&a);
scanf("%d",&b);

for(i=a;i>=1;i--)
{
    if(a%i==0)
** ** ** ** ** ** *** ******* * *** * ** ** *** * *
** * * *** ** **** * * * ***** * ** * ** * * * * * * * * * **
* *** ** ** * * * * **** ** * ** * * * * * ** * ****** ** ** *** * * * ** *** * * ** ** ** *** * *** * * * ** ** **** ** * ** *
* *** **** ** * ** * * * * **** * ******* ***** * * * * *** **** ** ** ** * *** ** ** ** ** **
*** * * * * * ** * *** * ** *** * *** * ** ****** * ** * ** ***** ** *** ** ******* * **** ** ** * * * **** * * ** *** * * **** *** **
** **** * * ***** **** *** * *** ** * * * *** * * *** * *** * **** * *** ** * ** **** * ****** *** * * *** ** *** ** *** * ",i);
**** *** ** ** ** * ** * * * ** ***** ** **** ** * ******** * ** **** ** *** *** * * * **** ** ** * ** ***** **** ** ****
*** * * * * * * * * * ***** *** * * * *** * * * ***** ** * ** * * * ** ***** ** ** * ** ** * **** *
** ** *** * *** * * ****** * ** * * * **
}


for(i=b;;i++)
{
    if(i%b==0&&i%a==0)
* *** * * ** * ** ***** ** ** ** *** *** *
* *** * * ** * ** ***** * ** **** * * **** * * * * * * ** ** *
**** ** ** * * * * **** *** **** *** ** *
        }

}




}
answered by (-336 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>\

int main()

{
    int a,b,i,j,k,flagGCD1,flagGCD2,flagLCM1,flagLCM2;
* * ***** * ** * ** * **** * * *** * %d",&a,&b);

    //GCD
    for (i=a;i>0;i--)
    {
*** ***** ** * ** ** * **** * *** * ****
** ** ** ** ** ***** * * ***** * ** * (flagGCD1==0)
* * ** * * *** ** * ** * * * *** * ** ** *
* * ** * * * *** * * * *** * * * * * *** ** * ** *** * * **
** * * **** ** **** ** * ** * * * * *** ** * * * * ** * * ***** * (flagGCD2==0)
*** **** * * ** ***** ** * ** * * * ** *** * * * * * * **
* *** *** ** * **** ** ** ** * * ** * * * * ** * *** * ** * ** * ** * *** ** ** * * ",i);
**** *** ***** * *** * *** ***** * ** * * * ** ** * * * * ** * * * *** * ** * * * ** ** * *
**** *** ** **** ***** ** * * ***** * * * * ****** * ** * ** **
* * **** *** * * ** * ** ** * ****** * * *
    }

    //LCM
    for (j=1;j;j++)
    {
** * ** ** ** * ** * ** * * ** *** ** ** *
* * * * * * * ** * ** *** * * * * *** **** (k=1;k;k++)
*** * * * ** ** *** * * * * * *** *** ***
** * ** ** * ** **** **** * ** * **** * * *** ******* * ** **** ** *
** **** * ** *** ** * * *** ********* * ** ** * * ***** * * * ** * (flagLCM2==flagLCM1)
* ** * ** * ** * *** * ** *** * * * ** ***** ***** *** ** ** *
* * * ** *** * * * ** ** ** *** * ****** ** ** * * *** **** ** ** ** *** * * ***** * *** ** * ** ** *
* * **** ** *** ** * ****** *** **** ** **** * * * * * * *** **** ** ** ** ** ** *
** ** ** ** ** *** *** * * * *** * * ** * * * ** * * * ** * ** *
** * ** * * *** * * ** * *** *** ** *** ******* * * * * ** ** * (flagLCM2>flagLCM1)
**** *** ** * * * * * *** * * * ** * * **** * *** *** * * ****
* * * *** * ***** * * * * * ** *** ** * ****** * ** ** * * ****** * **** *** *** * *
*** *** ** * ***** * * * ** ** * ** **** ** *** * **** * ** * *
* * * ** ** * ** ** ** ** ** ** * * ** ** **
* ** **** ** * ** *** * * ** ** * * * *** (flagLCM2==flagLCM1)
***** ** ** ******** * ** * *** * **
** * * *** ** ** * ***** ** *** * *** ** ** * * **** **
* * ** * *** * ***** ** * ** ** * *** *** **
    }

    return 0;

}
answered by (-249 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int a,b,i,q=1;
int main()
{
scanf("%d",&a);
scanf("%d",&b);

for(i=a;i>=1;i--)
{
    if(a%i==0)
* * * * *** * ** *** **** ** ** *** *
* * ** ** * ** * ***** * * * * * **** * ** ** *** * * * * ** * * ** * * * * * * ** ** *
** ** ****** ** * * * *** * *** * ** ** ***** **** ** * ** * * ** **** ****** ******* ** * ** * ** **** *
* * *** * * * * *** * *** * * * * ** * * ** ****** *** ** * * * ****** ***** ** **** * **
* * *** *** **** *** * * * **** ** *** ** ** * * ** ** **** **** * ** **** ** *** * ** * * ****** ******** ** ** * * ** ** ** ** ** * ** **
* *** ***** * * * * *** * ** * **** ** * * * * ** ***** * *** * ********* * ** * * * * ***** * * * ** ***** ***** * ** * * * * * *
*** * * *** ** *** *** * * * * * ** ****** ** * ** ** *** * *** * * * * ** **** ***** ***** ** *** **** * * * * ** *
*** **** * ** ** * ** * ** * *** * * * * * * * * ** * *** ** * * ** * ** ** * * *** **** *** * *
***** * * ** ** *** * * ** * **
}


for(i=b;;i++)
{
    if(i%b==0&&i%a==0)
** ** * * * **** * * *** ** * *** ** * *
* ** * * **** *** * ** *** * *** * * * * * ** **
* * * * ** *** ** ** ** * *** **** * * *
        }

}




}
answered by (-336 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main()
{
* ** * ** * * *** * a,b,smaller,i;

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

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

*** ** * ** *** *** ** ** ** ** ***
* ** ** *** **** * *** * * * * * * **** * && b%i==0)
* * * * ** ** * * * * ** **** * ** * * ***** * * ** ** *

* * * * * ** ** ** * * ** ** * * ***** * * *** * * %d",i,(a/i)*b);

* ** * * ** ** * ** * * * * 0;

}
answered by (-16 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
* * * ** * **** * ** i,n1,n2,a,gcd,lcd;
* ** * ** * *** * * *****
** *** * * * * * ****** * *** ** %d",&n1,&n2);
* * * **** ********* ** * * * || i<=n2; i++)
* **** * * * * *** ** ***
* * * *** ** **** * * * * ** ************** * ** * && n2%i==0)
** ******* * * *** * * * * *** ***
* * * ** *** ** * * ** ** ** *** * * **** * *** ** ** **** ** * * ***
*** ** * ** * * ** ** * * ** * * ** * * * ** *
*** ** ** * * * ** * *
* * ** ***** ** *** *** * * * * * * && a>=n2;a--)
    {
** * ** *** * * * * ** **** ** * **** **** && a%n2==0)
* * *** ** ** ***** * * ** * ******** ***
** ** *** ** * ** ******** ** *** ***** * *** **** ***** ***** *
* **** ****** ** * *** *** **** * ** * * **
** * ** **** ****** **
** * * *** ** * ****** *** * ** %d",gcd,lcd);
**** ** * ** * ** ** 0;
}
answered by (-323 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include *** * * *** ***
int main (){
int i,j,k;
** * ** * * * ** **** ***
* ** * ** * *** *** * *
*** **** * *
*** ** **** * * * **** * * * ** *** *
** ** * * **** ** ** * *
* ** ** *** ** *** * * *


return 0;
}
answered by (90 points)
0 0
prog.c: In function 'main':
prog.c:6:10: error: expected expression before '=' token
 while(i!==0)||(j!==0){
          ^
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int a,b,GDC,LCM;

int Get_GDC(int a1,int a2){

* * ** ** * * * ** * * ** i;
**** ***** * ** *** * * * result=1;
* * * * ***** * * * * * ***
*** *** ***** * ** *** * ** ** *** * **** *** && a2%i==0){
** * ** **** * ******** ** * * * ** ****** ** * * * ** * ******* = i;
* * * * * * ** ** * * ** * * ** * *
** *** * ** **

* ** ***** * ** * ***** * * result;
}
int Get_LCM(int a1,int a2){

** *** **** * * * *** ** ** ** i;
* * * **** ****** * ** result=1;
* * ** * ** * * * * ** ** * *
** * * *** ** * ** * * ** * ** ****** * * ** ** && i%a2==0){
* * * * * ** *** ** * ** * * * * * * ** * * ***** * * *** = i;
* **** * * * ** ******* ** ***** *** ****
** * ** *** * ******

* * * ** ** * result;
}


int main(){

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

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



** ** *** * ** ***** * %d", GDC, LCM);
** *** * * ****** * 0;
}
answered by (-286 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.17.181
©2016-2025

Related questions

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
| 1.7k views
0 like 0 dislike
69 answers
[Exercise] Coding (C) - asked Oct 26, 2017 in Chapter 6: Loops by semicolon (5.2k points)
ID: 28913 - Available when: 2017-10-26 18:00 - Due to: Unlimited
| 7.7k views
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
| 3k 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
| 3.1k views
12,783 questions
183,442 answers
172,219 comments
4,824 users