#include <stdio.h>
#define max(A,B) ((A>B)?A:B)
int x[]={3,4,4,7,8,8,8,8,9,10};
int main(void)
{
int i,arr,j,count,Maxvalue=0,Maxcount=0;
i = sizeof(x)/4;
printf("找出重複次數最多的整數以及次數\n");
printf("Have %d number\n",i);
for(arr=0;arr<i;arr++)
{
count=0;
for(j=0;j<i;j++)
if (x[arr] == x[j])
count++;
if ( count >= Maxcount ){
Maxcount=count;
Maxvalue=x[arr];
}
}
printf("Maxvalue is %d ,have %d \n",Maxvalue,Maxcount);
printf("%d\n",max(3,4));
return 0;
}
星期三, 3月 09, 2011
Categories: C
Posted on 星期三, 3月 09, 2011 by 【 المستقبل 】 (σ゚∀゚)σ
訂閱:
張貼留言 (Atom)
Who am I ?
Blog Archive
-
▼
2011
(55)
-
▼
3月
(22)
- [ Share Screenshot ]
- [Note] How to install firefox 4 under Linux Mint
- Update kernel version && ATI driver
- [C] Server/Client practice
- @ Android-x86 @ generic_x86 version
- Tabu 2.2 under linux mint
- [Note] How to unzip / zip initrd.img
- [C] parser file
- Linux mint's bash.bashrc / vimrc
- New Workspace OS
- What ? Why ?
- Git Server / Git Web
- Launch window form workspace 1 to workspace 2
- Ubuntu can't mount IOS 4.2.1 Device issue
- [Google] Learn Google extension
- Google Gadgets for Linux
- [SVN] How to remove file/floder under svn server
- [Flash] Flash 之 Hello World
- [C] 找出重複次數最多的整數以及次數
- I like X100
- 幸福水漾公園
- [C] Makefile Test
-
▼
3月
(22)
Popular Posts
Categories
- 丌 (3)
- addrinfo (1)
- Arduino (1)
- bashrc (1)
- C (12)
- chroot (1)
- code (1)
- ctags.cscope (1)
- endian (1)
- errno (1)
- Facebook (1)
- FLASH (1)
- Git (1)
- Google Gadgets (1)
- http (1)
- iphone (4)
- javascript (1)
- JB (1)
- libcurl (1)
- Life (3)
- linked-list (1)
- Linux (37)
- Mac (3)
- mysql (1)
- network (2)
- nodejs (4)
- queue (1)
- socket (2)
- SQLite (1)
- ssh (1)
- string (1)
- SVN (1)
- taglist (1)
- tar (1)
- tcp (1)
- thread (1)
- Ubuntu (1)
- win32 (1)
- Xcode (3)
Recent-posts
charles.world. 技術提供:Blogger.
0 意見:
張貼留言