|
|
|
|
|
摘要:
#includeint main(void){ int i,j,n,temp; int a[6][6]; printf("Enter n:"); scanf("%d",&n); for(i=0;i<n;i++) for(j=0;j<n;j++) a[i][j]=i*n+j+1; for(i=0;i<n;i++) for(j=0;j<n;j++) if(i<=j){ temp=a[i][j]; a[i][j]=a[j][i... 阅读全文
posted @ 2013-10-05 22:27
琼溪
阅读(122)
推荐(0)
编辑
摘要:
#includeint main(void){ int col,i,j,row; int a[3][2]; printf("Enter 6 integers:\n"); for(i=0;ia[row][col]){ row=i; col=j; } printf("max=a[%d][%d]=%d\n",row,col,a[row][col]); return 0;}#includeint main(void){ int i,j; in... 阅读全文
posted @ 2013-10-05 22:16
琼溪
阅读(130)
推荐(0)
编辑
摘要:
#includeint main(void){ int a[10]={1,2,3,4,5,6,7,8,9,10}; int low,high,mid,n=10,x; printf("Enter x:"); scanf("%d",&x); low=0;high=n-1; while(low<=high){ mid=(low+high)/2; if(x==a[mid]) break; else if(x<a[mid]) high=mid-1; else ... 阅读全文
posted @ 2013-10-05 21:56
琼溪
阅读(100)
推荐(0)
编辑
摘要:
#includeint main(void){ int i,index,n; int a[10]; printf("Enter n:"); scanf("%d",&n); printf("Enter%d integers:",n); for(i=0;iint main(void){ int i,index,k,n,temp; int a[10]; printf("Enter n:"); scanf("%d",&n); printf("Enter%d integers:& 阅读全文
posted @ 2013-10-05 21:26
琼溪
阅读(128)
推荐(0)
编辑
摘要:
#includeint main(void){ int i,flag,x; int a[5]; printf("Enter 5 integers:"); for(i=0;i<5;i++) scanf("%d",&a[i]); printf("Enter x:"); scanf("%d",&x); flag=0; for(i=0;i<5;i++) if(a[i]==x){ printf("Index is %d\n",i); flag=1; break; ... 阅读全文
posted @ 2013-10-05 21:13
琼溪
阅读(135)
推荐(0)
编辑
摘要:
#includeint main(void){ char ch; printf("input characters:"); ch=getchar(); while(ch!='\n'){ if(ch>='A'&&ch='a'&&ch<='z') ch=ch-'a'+'A'; putchar(ch); ch=getchar(); } return 0;} 阅读全文
posted @ 2013-10-05 21:05
琼溪
阅读(96)
推荐(0)
编辑
摘要:
#includeint main(void){ int count[9]; int i,response; for(i=1;i8) printf("this is a bad response:%d\n",response); else count[response]++; } printf("result:\n"); for(i=1;iint main(void){ int i; int fib[10]={1,1}; for(i=2;i<10;i++) fib[i]=... 阅读全文
posted @ 2013-10-05 20:52
琼溪
阅读(145)
推荐(0)
编辑
摘要:
#includeint main(void){ char ch='w'; int a=2,b=3,c=1,d,x=10; printf("%d",a>b==c); printf("%d",d=a>b); printf("%d",ch>'a'+1); printf("%d",d=a+b>c); printf("%d",b-1==a!=c); printf("%d\n",3int main(void){ char ch= 阅读全文
posted @ 2013-10-05 20:06
琼溪
阅读(120)
推荐(0)
编辑
摘要:
#includefloat cash;int main(void){ int choice; float value; void income(float number),expend(float number); cash=0; printf("Enter operate choice(0--end,1--income,2--expend):"); scanf("%d",&choice); while(choice!=0){ if(choice==1||choice==2){ printf("Enter cash ... 阅读全文
posted @ 2013-10-05 19:43
琼溪
阅读(129)
推荐(0)
编辑
摘要:
#includefloat result_real,result_imag;int main(void){ float imag1,imag2,real1,real2; void complex_prod(float real1,float imag1,float real2,float imag2); void complex_add(float real1,float imag1,float real2,float imag2); printf("Enter 1st complex number(real and imaginary):"); scanf(... 阅读全文
posted @ 2013-10-05 19:42
琼溪
阅读(100)
推荐(0)
编辑
摘要:
#include#includeint main(void){ int count,m; int prime(int m); count=0; for(m=2;mint main(void){ void pyramid(int n); pyramid(5); return 0;}void pyramid(int n){ int i,j; for(i=1;iint main(void){ void pyramid(int n); pyramid(5); return 0;}void pyramid(int n){ in... 阅读全文
posted @ 2013-10-05 16:46
琼溪
阅读(105)
推荐(0)
编辑
|
|