1、 t = a%b; a = b; b = t;, origa, origb, a);3、 int x;%dx); int mask = 1; int t = x; while ( t9 ) t /= 10; mask *=10; x=%d, mask=%dn, x, mask); do int d = x / mask; printf(, d); if ( mask 9 ) printf( ); x %= mask; mask /= 10; while ( mask 0 );n4、 int n; double ret=0.0;n); for ( i=1; i=n; ret += 1.0/i;%
2、fn, ret);5、 int sign = 1; ret += 1.0*sign/i; sign = -sign;6、 int one, two, five; for ( one = 1; one x*10; one+ ) for ( two = 1; two x*10/2; two+ ) for ( five = 1; five x*10/5; five+ ) if ( one + two*2 + five*5 = x*10 ) printf(可以用%d个1角加%d个2角加%d个5角得到%d元n, one, two, five, x); break; 7、 int exit = 0; ex
3、it = 1; if ( exit = 1 ) break; if ( exit = 1 ) break;8、 goto out;out:9、 int isPrime = 1; / x是素数 for ( i=2;x; if ( x % i = 0 ) isPrime = 0; break; if ( isPrime = 1 ) 是素数n不是素数n10、 for ( x=1; x=100; x+ ) int i; int isPrime = 1; for ( i=2; if ( x % i = 0 ) isPrime = 0; break; if ( isPrime = 1 ) %d , x);
4、 11、 int cnt = 0; x = 1; while ( cnt , n); n-;发射n14、 int number = rand()%100+1; int a = 0;我已经想好了一个1到100之间的数。请猜这个1到100之间数:a); if ( a number ) 你猜的数大了。 else if ( a 1 ) x /= 2; ret +;log2 of %d is %d., t, ret);16、stdlib.htime.h srand(time(0); int a = rand();%dn, a%100);17、 int digit; while ( x 0 ) digit
5、 = x%10;, digit); ret = ret*10 + digit; / printf(x=%d,digit=%d,ret=%dn, x, digit, ret); x /= 10; / printf(每周编程题目源代码18、 int i=0;,&i);,(i%10)*100+(i%100/10)*10+i/100);19、 int h,m,input,b;input); h = input/100; m = input%100;if (h=8),b = (h-8)*100+m); else,b = (h+24-8)*100+m);20、#includeint a100000;int
6、 isprime(int x) if (x=2|x=3|x=5|x=7) return 1; for (int i=2;i*i=x;i+) if (x%i=0) return 1; int n,m;%d%dn,&m); int k=0;k=m;i+) if (isprime(i)=1) ak+=i; int sum=0; for (int i=n-1;ichar ans1210=ling,yiersansiwuliuqibajiu; if (x=0)%s,ansx); int flag=0; if (x=0;i-) if (flag=0),ansai); flag=1; else %s25、%
7、d/%da,&,a/b); a=a%b; if (a) printf( while (a!=0 & k200) if(ab) a=a*10; k+;判断类型源代码32、 const int MINOR = 35; int age = 0;请输入你的年龄:age);你的年龄是%d岁。, age); if ( age = price ) 35、你的钱不够n36、 int hour1, minute1; int hour2, minute2;hour1, &minute1);hour2, &minute2); int ih = hour2 - hour1; int im = minute2 - minute1; if ( im b ) max = a;大的那个是%dn, max);38、/ max3.c int a,b,c;%d %d %db, &c); int max = 0; if ( a if ( ac ) max = a; else max = c; if ( b max = b;The max is %dn39、 const double RATE = 8.25; const int STANDARD = 40; double pay = 0.0; int hours;请输入工
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1