#include #include int IsPrime(int num){ int i= 2; if(num ==1) //1既不是质数也不是合数 return 0; for(;i<= num /2;i++) //或者是for(;i
#include #include void test(){ int a=0, b=0; int i=0, j=0; scanf( "%d%d", &a, &b); if(a
#include #include void test(){ int a=0, b=0; int i=1; scanf( "%d%d", &a, &b); while(!(i%a==0 && i%b==0)) { i++; } printf( "least common divisor is: %d\n" , i); /*for(i=1;;i++) { if(i%a==0&&i%b==0) { printf("least common divisor is: %d\n", i); break; } }*/}int main(){ test(); system( "pause"); return 0;}
#include #include void test(){ int a=0, b=0; int c=0; scanf( "%d%d", &a, &b); printf( "a=%d, b=%d\n", a, b); c= a; a= b; b= c; printf( "a=%d, b=%d\n", a, b);}int main(){ test(); system( "pause"); return 0;}
#include #include void swap(int * i, int* j){ int tmp= *i ; * i= *j ; * j= tmp;}void test(){ int a=0, b=0; scanf( "%d%d", &a, &b); printf( "a=%d, b=%d\n", a, b); swap(&a, &b); printf( "a=%d, b=%d\n", a, b);}int main(){ test(); system( "pause"); return 0;}