- 博客(10)
- 收藏
- 关注
原创 习题7.3lj
#include int Max(int a,int b); int main() { int max,a,b; scanf("%d%d",&a,&b); max=Max(a,b); printf("%d\n",max); return 0; } Max(int a,int b) { int max; if(a { max=b; } else max
2018-01-01 22:25:22
175
原创 习题6.1.2lj
#include int main() { int k=4,n; for(n=0;n { if(n%2==0)continue; k--; } printf("k=%d,n=%d\n",k,n); }
2018-01-01 22:23:37
151
原创 6.8lj
#include #include int main() { double pi,sum,term,sign; int count,n; count=0; n=1; sum=0; sign=1.0; do { term=sign/n; sum=sum+term;
2018-01-01 22:21:46
172
原创 7.4lj
#include int Lcm(int a,int b); int main() { int a,b,x; printf("Input a,b:"); scanf("%d,%d",&a,&b); x=Lcm(a,b); if(x!=-1) printf("%d,%d,%d\n",a,b,x); else printf
2018-01-01 22:20:06
182
原创 10.4lj
#include int CountWords(char str[]); int main() { char str[20]; printf("Input a string:"); gets(str); printf("Numbers of words=%d\n",CountWords(str)); return 0; } int Co
2018-01-01 22:19:13
207
原创 11.4lj
#include #define N 10 void Swap(int *x,int *y); void Transpose(int a[][N],int n); void InputMatrix(int a[][N],int n); void PrintMatrix(int a[][N],int n); int main() { int s[N][N],n;
2018-01-01 22:18:12
183
原创 6.6lj
#include #define RATE 0.01875 #define MONTHS 12 #define CAPITAL 1000 #define YEARS 5 int main() { int i; double deposit; deposit=0; for(i=0;i { deposit=(deposit+CAPI
2018-01-01 22:17:09
270
原创 6.9lj
#include #include int main() { int n=1,count=1; double e=1.0,term=1.0; long fac=1; for(n=1;fabs(term)>=1e-5;n++) { fac=fac*n; term=1.0/fac; e=e+t
2018-01-01 22:16:09
234
原创 6.11lj
#include int main() { unsigned long i,n,term=1,sum=0; printf("Please enter n:"); scanf("%lu",&n); for(i=1; ;i++) { term=term*i; sum=sum+term; if(sum>=n) break; }
2018-01-01 22:14:41
122
原创 6.13lj
#include int main() { int i=0,n,sum=0; printf("Input a number:"); scanf("%d",&n); while(n!=0) { if(n>0) { sum=sum+n; i++;
2018-01-01 22:11:02
126
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人