|
|
|
|
|
摘要:
#includeint main(void){ int i,n,m; char s[10]; printf("Enter a string:"); i=0; while((s[i]=getchar())!='\n') i++; s[i]='\0'; for(n=0,m=i-1;n=m) printf("It is a plalindrome\n"); else printf("It is not a plalindrome\n"); return 0;} 阅读全文
posted @ 2013-10-06 10:03
琼溪
阅读(103)
推荐(0)
编辑
摘要:
#includeint main(void){ int count,i; char str[80]; printf("Enter a string:"); i=0; while((str[i]=getchar())!='\n') i++; str[i]='\0'; count=0; for(i=0;str[i]!='\0';i++) if(str[i]='0') count++; printf("count=%d\n",count); return 0;}#includeint mai... 阅读全文
posted @ 2013-10-06 09:40
琼溪
阅读(161)
推荐(0)
编辑
摘要:
#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)
编辑
|
|