4 like 0 dislike
9.7k views

給予一個數列,請寫一個程式找出其中最大的數,最小的數,以及出現最多次的數。

 

輸入說明:

一開始會先輸入一個正整數N,N不會超過1000,接下來的N個正整數就是要處理的數列。

 

輸出說明:

請依序輸出三個數,分別代表最大的數,最小的數,出現最多次的數。如果出現最多次的數不只一個,請輸出其中最大的那個。

 

輸入範例:

5
1 1 2 2 3

 

輸出範例

3 1 2
[Exam] asked in 2017-1 程式設計(一)AD by (30k points)
ID: 38940 - Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 9.7k views

16 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int x,max=0,min=0,size=0;
*** * * ** ** * * * ** *** * ** ** * **
* ** ** ** *** * ** *** arr[x],amount[x];
* * * ** * * * * * ** * *** i;
* ****** ** ** * * ** ** *** * ***
* * * ** * **** ** * *** * ** * *** * * ** ** * ***
* ** * **** **** * * * * * *
    int j;
** ** ***** * *** **** **** ***
    {
** * * * * ** ** ******* ******* * ** ***** ***** *** ** **
*** * * ** * * * * *** ** ** * ** * * ** * * * * ***
* ** * **** * ** **** *** *** *** **** * * **** * ** *
* * ** ** ** * * ** * ** ***** * ** *** * * ****** * * * *** * ****
    }
** ** *** ** *** ******* ********
    {
***** * ** ** ** ** ***** * * * ** ** ** * * ***** * ** *
**** ***** * * * * * ** *** *** * * *
* * * * *** ****** ** ***** * * * ** **** *** *** * * * **** *** * *** * * *
* *** * * * ** * ** * * * *** **** * * * * * ******** *** * ** * *** ***** * ***
** **** ** * * * **** * ****** ** * * *** * *
    }
    int temp=0;
** *** ** ******** **** *** **** **
    {
********** ** * ** * * ** * ** ******** * ** * * ** ** ****** **** * ** * ** * ** ***
** **** *** *** * * *** * ****** ** * *
** * * *** * ** ** ***** * *** **** * * ** ** **** * **** ** * * *** * * *
* * * * * ** * * *** ** ******** ****** *** * *** ** * * * **
** *** * * * * * ** * * ***** ** *** *
    }
* ** * ** * ***** * *** ** ** %d %d\n",max,min,arr[size]);
* * * ** *** * 0;
}
answered by (160 points)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 like 0 dislike
Hidden content!
include<stdio.h>

int main()
{
*** ** *** * * * ** ** * n,max=0,min=0;
* **** *** ** *** *** **** ** num=0,temp=0;
* * **** * * * * ** * ** * ** ****
** * *** * **** * * * arr[1000],amount[1000];
* **** ** ***** * * * * **** i;
**** ******* *** ** ** ***
* ****** ** ** **** * * * *** ** *** * ** * ** ******* * ***** * ** ** *** * *
** * ** * ***** * * * *
* ** ******** ** * * * ** * j;
    
* ** ** * ** *** *** ** * * ** ** ** *
    {
* * * * ** ** * *** * * ** * * ** * **** ** ** * *
* * * * **** ** * ** * ** * * * **** ** * * * *** ** * ********
* * ** * * ** * *** *** ** *** * * ** * * * *****
*** *** *** ** ** *** *** ** ** * *** * * ** * * * ** ** ** ** *
    }
** * * ** * * * * *** ** *
    {
** ***** ** *** ** ** ** ** * ** ** *** * ** *** ******
****** ** ** ******* ** * *** ** * **** *
***** ** *** * * *** ***** * ** **** **** * **** * ** ** ** ** * * * * *
** * ** ** * * *** ** *** ** ** * * ****** * ***** * ** *** *** * *** *** * ** * * ** *
* ** * * *** * * * * ***** * * ** *
** ** * * * **
   
    
* ** ** * ** *** * * * ** * * * *
    
    {
*** ** * ** * *** *** *** *** * * ** ** ** **** **** ** * ** ** ** **
** ****** * ** * * * * * **** **** ** * * **
* ** ** * *** * *** ** * *** *** * * **** * **** *** *** *** ****** * * **
*** * ** ***** ** ** * * ***** * ** ** * * * * ***** * ***** ****
* * * * *** * * ** * * * ****** ** ** ***** *
    }
** * * * * * * *** ******** ** %d %d\n",max,min,arr[num]);
*** * * * ** *** * * 0;
    
}
answered by (174 points)
edited by
0 0
prog.c: In function 'main':
prog.c:11:18: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
          scanf("%d",arr[j]);
                  ^
prog.c:13:8: error: 'max_length' undeclared (first use in this function)
     if(max_length<current_length)
        ^~~~~~~~~~
prog.c:13:8: note: each undeclared identifier is reported only once for each function it appears in
prog.c:13:19: error: 'current_length' undeclared (first use in this function)
     if(max_length<current_length)
                   ^~~~~~~~~~~~~~
prog.c:18:20: error: expected expression before '{' token
     current_length={0};
                    ^
prog.c:22:36: error: 'n' undeclared (first use in this function)
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                    ^
prog.c:22:41: error: 'max_lenhth_num' undeclared (first use in this function)
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                         ^~~~~~~~~~~~~~
prog.c:22:55: error: expected ')' before ']' token
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                                       ^
prog.c:22:55: error: expected ';' before ']' token
prog.c:22:55: error: expected statement before ']' token
prog.c:22:56: error: expected statement before ')' token
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                                        ^
0 0
prog.c: In function 'main':
prog.c:11:18: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
          scanf("%d",arr[j]);
                  ^
prog.c:13:8: error: 'max_length' undeclared (first use in this function)
     if(max_length<current_length)
        ^~~~~~~~~~
prog.c:13:8: note: each undeclared identifier is reported only once for each function it appears in
prog.c:13:19: error: 'current_length' undeclared (first use in this function)
     if(max_length<current_length)
                   ^~~~~~~~~~~~~~
prog.c:18:20: error: expected expression before '{' token
     current_length={0};
                    ^
prog.c:22:36: error: 'n' undeclared (first use in this function)
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                    ^
prog.c:22:41: error: 'max_lenhth_num' undeclared (first use in this function)
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                         ^~~~~~~~~~~~~~
prog.c:22:55: error: expected ')' before ']' token
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                                       ^
prog.c:22:55: error: expected ';' before ']' token
prog.c:22:55: error: expected statement before ']' token
prog.c:22:56: error: expected statement before ')' token
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                                        ^
0 0
Case 0: Wrong output
0 0
prog.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
 include<stdio.h>
        ^
0 0
prog.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
 include<stdio.h>
        ^
0 0
prog.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
 include<stdio.h>
        ^
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()
{
    int temp,n,most,mostt=0,big,small;
    int i,j;
    
*** *** * * ** * ** ***** * * * ** *
    
    int input[1000]={0};
    
* * * * *** *** ** * *** * * ** *
* ***** * ** ** * * * **** *** ** * * ** **** * ** * *
    
* ****** ****** * * * ** ** ** * * ****
    {
* * * *** * ** ** ** * * * * ** **** * ** *** * **** * **** * * * * * *** * * *** * ****** * * * ******** ** t=0;
* ** *** * * ** * **** * * ** ** * ** * ***** * * *** * * * **** * *** * * ** * * * ** * * * ** **** *
* * * ** ** * * * *** * * **** * * ** * * *** * * * *** ** * **** * *** * * *** * * * *** *
**** ** *** ** * **** * ** ** **** ** ** ** * *** * * * * ********* **** *** ************* * **** **** *** * * ***** ** ** **** * * *** *** * * * * *** **** ** *** * * * * ** **** * ** **
** ** ** ** * * * **** * * * **** * ** * *** ** ** * * * *** * *** * *** ** **** * * **** * *** *** ** * ** * * * * ** * * ** **** ** * * * * ** * ** **** * * * * * ** * * *** ****** **
* ** ** ** ** ** * ********* *** *** * * ** ********* * ****** * ** * ***** * * ** *** * ** *** ** * * ** * ****
* * * *** * ** ** * *** ******* ** *** ** ** * * * * * ** * *** * ** ** * ** *** ** ** ** * * *** * * && most<input[i])
** * * * *** * * * * * ** * * *** * ** * * ** * **** ** * *** * * * * *** * ** ** * ** ** ** **
* * * * * * **** ** ** ** ** **** * * ***** **** * ******* ***** ** *** * * * * * **** * *** ** ** ** * ** * * ******* **** ** ***** *** * * *** *** * * *** *** ***
*** **** ** * * * * ***** **** * * * * ***** * ** * ** * * *** ** * *** * * * * **** * *** ** * * *** * *** * **** * ** *** * * *** * * * * ** * * * * * ** *
** * ** * *** * ** * *** **** * **** * ** ** ** **** ***** ** * * * * * * * *** * * *** * ** *
    }
    
* * * **** **** **** ** * **
** * ** ** ************* ** *
    {
** * * * **** * *** *** *** ** **** ** * * * * ** * * * * * *** * **** ** ***** ******* * *** ** * ** ** ** * ** ***
* * * * * * ** ** * * **** * * *** **** **** *** * *** ** * * * * ***** **** *** ** **** ** * * **** * *** * * ***
    }
    
**** * **** * ******* *** * ** **
** * ** * *** ** * **** * *
    {
** ** * * * * ** * *** * *** * ** * ** ** *** * * ** * ** ** * * * ** ** ** ** ** *** * *** * ** ** ** *
** * * ** * * * *** * * *** ******** ** * ** ** **** *** ** ** * ** * * ** *** * ***** **** * * * * *** * * * *
    }
    
* * ** * * ** ** ***** ****** ** %d %d\n",big,small,most);
    
    return 0;
    
}
answered by (215 points)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int x,max=0,min=0,size=0;
* *** * ** * * **** * ****** *** **** *** * *
*** * * * arr[x],amount[x];
* ** ** * * i;
** * ***** * * * * * * * ****** *** *
* * ** **** **** *** ** ****** * * *** ** *** ** * * *** * *** * *** ***** **
* ** * ** *** * * * **
    int j;
* * * * ** ** ** *** *** * **
    {
*** * *** * **** **** * * * * ** * * *
* * ** * *** *** * * ** **** ******* * * ** * ****** * **** * ***
**** * ** ****** * * ** *** * ***** ** * * ** *
**** * ****** ** **** * ** * * ** * ** * * * * * * *
    }
** ****** ** * ** * * * *
    {
*** * * ** ** * * * * * * * ** ** * * * **** ** *** *
** **** * * ***** ** ****** * * * * * * ** *
** * *********** * * * * * ** *** * * ** *** ** *** * * *** *
* *** * ** * * ** ** * ** **** ** ** * **** * * ** **** * * ** * * ** * * * *** * **** ** *
* ** * * ** ** * * * ********* ** * *** * ***
    }
    int temp=0;
*** * ** * * ** *** * * *** ***
    {
**** * * * *** *** ** ** * * * * *** * * ** * * ** **** ** * *** *** * * * ** * * *
* **** ** ********* * * ** *** ** *** ***
** * ** *** ** ** ** * *** * ** * * ** * * **** *** ** * * ****
** ** * *** *** * ******* * ** *** * *** * * ** * ** ****** ** * *
** ** * * ** * ** ** * * * * **** * *
    }
*** * ** *** *** ** * * ** %d %d\n",max,min,arr[size]);
**** * **** * * ** * * * * * 0;
}
answered by (100 points)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
* ** ***** ** * * *** ** n, current_num, current_num_length, max_length = 0, max_length_num, temp;
** * * * ** * ** ** ** i, j, k;
** * ****** * ** * *** * * arr[1000];
* ** ** ** * * * ** ** ** ** ****** *** *
    
* * **** * * ** ** * = 0;i<n;i ++)
    {
** *** ** ** ** *** * ** * *** * * **** * *** * *** * *****
* ** ** * *** **** ** ***** * **** ** = i+1;j<n-1;j++)
* * ******* * ** * ** *** *********** *
* * * * * ****** * * * * ***** ** ** *** ** **** * *** ** > arr[i])
* **** * *** **** ***** * **** * * ** ** ** * ** * * *** *** *   
* * * * ** * * ******* *** * * * * * * * *** ** **** ** ** * * ** *** =  arr[j];
**** **** *** *** ** * * *** ** ** * * ******* * ** ** ** * *** * **** * * * * * * = arr[i];
****** * * * * ** * * ** ** * *** ** * * *** *** * ** *** * * * * = temp;
** ****** ** * * * *** *** *** * ** * *** * * ** **   
** **** * ** ****** * ******** ** * *
    }
    
*** * *** * * *** * ** * * * = arr[0];
* *** **** **** * * * ** * ** ** ** = 1;
* ** ** * * **** * ** * * *****
* ** ** ** *** *** ** * ** = 1;k<n-1;k++)
***** * *** ** * ** **
*** ** * **** * ** *** * *** *** * *** = arr[k])
* ** * * ***** ** * * * * * * ** * * * * **
* * * *** ** **** * *** * * * * ** ** **** **** * * *** ** ** ++;
* ** * * * ** *** * ** * * * * * **
* ******** * ** * ****** * * * ** * * **
* * *** **** ** ******** ** ********** ** * *** ** * * = 1;
***** * **** **** ******* ** *** * * * ** * > max_length)
* * ** ** * * ** **** * * ***
** ** ** * ** * ******** * ** * * ** * * = current_num_length;
* ** ** ******* * ******** * * *** * *** * * * = current_num;
** * *** *** ** ** * **** * * ** ** * * **** * **** ** * * *****
* * ** ** * ** * * * * * *** * **
* ** * * **** ** ** * *
*** * * * ** **** * ** %d ** * * * *** * * * *     
    
***** ***** *** * ** 0;
}
answered by (212 points)
0 0
Case 0: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int x,max=0,min=0,size=0;
** * ** * * * * * * * ** * * * *
** ********* ** * * *** arr[x],amount[x];
*** * * ** ** * *** i;
** * ** * ** * * **** *** * * ***
* ** * * * *** ** * *** * ** * **** * * ** ** * **** * ** ** *
* *** ** ** ** *** *** * **
    int j;
* *** ** * * * * *** ** **** * * **
    {
* * ** * *** ** * * *** ** ***** *** ****** ** *** **
***** * ** * ** * * ** *** * ****** * ** ** * **** ** ** * ** *
** ** ** ** * ** * * ** ** * ** * * **** * **** **
*** ** **** ***** * * **** * *** * * * ** *** * * **** ********** *
    }
* ** * ** * * * *** ******* * *** *
    {
* ***** **** * * *** * * * * **** *** ** ****** * ****** *
* * * **** ** *** * ****** *****
* *** * * *** ** ****** ** * * **** ***** *** ** * *** ******
* ** * ** ****** * ** ** ** ** *** **** ** ** *** * * * * * * ** * ** ** * * ** * * * ** *
* *** ** ** *** *** ******* * * * ** ** *
    }
    int temp=0;
** * ***** *** * * * * **
    {
* * * * ** * * ** * ** * * * ** * * * * * ** ** * * ***** * * * ** *** ** * **
* * * * ** * ** ** ** * ** ****** ***
* ** ** * ** *** * * *** ** ** * * ** ** * *** *** * **** *** *** ** *
******** *** ** *** * * * * *** ** * * * * ** * *****
*** * * *** ** * *** * ** *** **** ** * *
    }
** ** *** ** * * ** * * %d %d\n",max,min,arr[size]);
* *** * * *** * ** ***** 0;
}
answered by (190 points)
edited by
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()
{
    int temp,n,most,mostt=0,big,small;
    int i,j;
** * ** * * * ***** * *** *** ** ** ** *** * * **
    int input[1000]={0};
**** *** ** * * *** ** ******
* * *** * * * ** * * * * * * *** * * **** **** *** * * * ** *
* * * * * * * ** ** ** *** * * **
    {
*** * ** * * ** * ** * * *** * ** * *** * * * ** t=0;
** ** * * * ** ** * * * *** ** * *** ** *** ** *
* *** * *** * ****** ** * ****** * * ** * *
* * ** * * * * *** * *** * * ** * * * *** * *** ** ** * **** * ** *** ** ** *
** * ** ****** ** * * ** ** ** **** ** * ** * *** **
* ** ** * *** ** *** * * ** **** *** ** ** * * * ** ** *** *** *** * *** ***** ****** * * * *** *
* ** ****** *** * * *** **** * ** **** ** ** ** ** ** * * *
** ***** * * * * * ** ** * * * *** * *
** ***** * * *** ** *** * * ** * * * ** * **** ** * * * * * && most<input[i])
** *** * * * * * * * * ** ******* *
**** **** * * *** * **** * ***** ** * * * **** **** * * * *** ** *** ******* * **
* ** * *** *** ** * * * * * * * ******** * * ** ** * ** * * * * * * ** * * **
** * ** * * ** **** * **** * * **
    }
* ** ** * **** * **** ****** * ***** *
* * * * * ** * ** ** * * * *
    {
* * *** ** * * *** ** * ***** ** * * ** ** ** * ** * *****
*** * ** * *** ** *** *** * * *** ** ** *
*** **** * * ** * * * * ** * * * ** * * * * ** ** ** * *** * ** *
* * * * ** ** ** *** *** ******* * *** *
    }
* **** ** ***** * * * * ****** ** * **
** **** ** * ** * * ** ** ***** * **** **** **
    {
***** ** **** ** * ** * *** * * ** * ** * ** * *
* ** *** ** *** * * *** ** ** * * ********
** * ** ** *** * ** ******* ** * ** * ***** * ***** * **** ******** * **** **
* * ** *** ***** ** * *** * ** * * ** *** * **
    }
    printf("%d %d %d\n",big,small,most);
    return 0;
}
answered by (131 points)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int arr[1000];
    int i,j, n,count;
    int most=0,mostt=0,big ,small;
* * **** ** * * ** ** * * * * *****
* * **** ** ** *** * * * * * **
***** **** ** * * ** ***** ** **** ** * ** * ********* * ***** * *
**** **** * * * * * ** * *
    {   
**** ** * **** * *** ** * **** ** *** * *
* ** * * * * * * *** **** * **** ** * ***** *******
** * *** * *** *** * ** ** **** * **** * ** * **
* *** * **** ** ** * **** ** ** * *** ** * ** * ***** *** *** ** ** * *** **** *
* * * ** * * * * * ****** * * **** * ** * * * * * ** ******** *** *** * * * * * * **
** * ** ** * ******* * ** * ****** * ** * * * **** *
*** ****** ** ** ** ** ** ** ** ** * * * * ** ***** ** * ** * ** * && arr[i]>most)
*** ** ** *** ** * * ** * * * * ** * * * * * * **** ** *
* *** * ** * ** ** *** ****** * ** ****** * * ** ** ** * ** ** ** * * * * ********** ***** ** *
* ** ** ********** * * *** *** *** * * *** * ** * * ** * * * * * * *** ****** * * ******* ** * * * *** *
** * * ** * * *** * * * * * *** * *** * *** ***** **** ***
** ** * * * ** * * ** ** * * ** ******
     }
     
**** **** * * ** ** * **** * *
* *** * * **** * ** **** * ** * *** * **
     {
* ** ** **** *** * *** * *** ** * * ** * ** * * * **** ** * *
*** **** * * *** * **** ** * * ** * ***** * * **** *
* * * ** ** *** *** * * ** * **
* **** * * * * **** * *
* ******** * * * * * * * * *
* *** *** * * ** ** ** * * *** ******
     {
* ** *** * * * * * * ** ***** * * * ** * *** * *** * ** * * * * * *
** ***** **** ** *** ** ** * * ** * ***** ****** * * *** ** *
* *** * ** * ** *** * * * ***
** * ****** * **** ** *** *
* * ** * * * * ** ** * ******** * * *** * *** %d %d\n",big,small,most);
      
}
answered by (172 points)
edited by
0 0
prog.c: In function 'main':
prog.c:9:16: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'char *' [-Wformat=]
        scanf("%d",&arr[i]);
                ^
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int n, temp, i, j,current num, current numlen;
******** ** **** * ** * * ** ** * **** **
* ** *** * * * * *** ****
* * ***** *** *** ** ** * *** *** ** * ** * **** * * * * * * *
* ** ** * ** ** ** ** ** *** *** ** * * *
* ** * * ** *** * ** ** * * ** * *** *** *** * * ** * ** * ** * ** ** * * * ** * *** ** * ** * ** ** ** **
* ** ** * ** * ***** * **** **** * * ** * * * ** **** ****
** * * **** **** ** * ** ***** **** * * * **** * ** * * ** * ** * *** *
* **** * ** **** * ***** ** ** * * * * * *** * * ****** * * * *
**** * * * **** * ** **** * * * * * * * ***** * **** ***** ** * ** * *
***** * * ** * * ** ** ** * * *
    }
    current num=num[0];
    current numlen=0;
** *** ** ** ** * *** ** * * ** *** * * num);
* ** ** * ** * ***** * * **** *** **** ** *** **
**** * ** ** * ** ** * ***
** * * ** *** ** * ** * * * * **** *
**** * * * ***** ***** * ** ***** *** ** ** * ***** * numlen++;
*** ** ** ** *** * * * ** *** * if(num[i]!=num[i+1])
* ***** * * * * ** * ** ** ***** * **** *** ***** * ** num=num[i+1];   
    } * * **** *** * * * * ** ** ** **
* * ** * ** ** * * ** *** ** * * * * * numlen); * **** ** ** ** ** * **
* ***** *** *** * * *** *** * * * ***** *
    return 0;
}
answered by (144 points)
0 0
prog.c: In function 'main':
prog.c:4:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'num'
     int n, temp, i, j,current num, current numlen;
                               ^~~
prog.c:7:20: error: 'num' undeclared (first use in this function)
        scanf("%d",&num[i]);
                    ^~~
prog.c:7:20: note: each undeclared identifier is reported only once for each function it appears in
prog.c:9:25: error: expected ';' before ')' token
        for(j=i+1,j<n;j++){
                         ^
prog.c:16:5: error: unknown type name 'current'
     current num=num[0];
     ^~~~~~~
prog.c:16:20: error: subscripted value is neither array nor pointer nor vector
     current num=num[0];
                    ^
prog.c:17:5: error: unknown type name 'current'
     current numlen=0;
     ^~~~~~~
prog.c:18:17: error: 'current' undeclared (first use in this function)
     printf("%d",current num);
                 ^~~~~~~
prog.c:18:25: error: expected ')' before 'num'
     printf("%d",current num);
                         ^~~
prog.c:19:20: error: subscripted value is neither array nor pointer nor vector
     printf("%d",num[n-1]);
                    ^
prog.c:21:14: error: subscripted value is neither array nor pointer nor vector
        if(num[i]==num[i+1])
              ^
prog.c:21:22: error: subscripted value is neither array nor pointer nor vector
        if(num[i]==num[i+1])
                      ^
prog.c:22:19: error: expected ';' before 'numlen'
           current numlen++;
                   ^~~~~~
prog.c:23:19: error: subscripted value is neither array nor pointer nor vector
        else if(num[i]!=num[i+1])
                   ^
prog.c:23:27: error: subscripted value is neither array nor pointer nor vector
        else if(num[i]!=num[i+1])
                           ^
prog.c:24:19: error: expected ';' before 'num'
           current num=num[i+1];
                   ^~~
prog.c:26:25: error: expected ')' before 'numlen'
     printf("%d",current numlen);
                         ^~~~~~
0 0
prog.c: In function 'main':
prog.c:4:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'num'
     int n, temp, i, j,current num, current numlen;
                               ^~~
prog.c:7:20: error: 'num' undeclared (first use in this function)
        scanf("%d",&num[i]);
                    ^~~
prog.c:7:20: note: each undeclared identifier is reported only once for each function it appears in
prog.c:9:25: error: expected ';' before ')' token
        for(j=i+1,j<n;j++){
                         ^
prog.c:16:5: error: unknown type name 'current'
     current num=num[0];
     ^~~~~~~
prog.c:16:20: error: subscripted value is neither array nor pointer nor vector
     current num=num[0];
                    ^
prog.c:17:5: error: unknown type name 'current'
     current numlen=0;
     ^~~~~~~
prog.c:18:17: error: 'current' undeclared (first use in this function)
     printf("%d",current num);
                 ^~~~~~~
prog.c:18:25: error: expected ')' before 'num'
     printf("%d",current num);
                         ^~~
prog.c:19:20: error: subscripted value is neither array nor pointer nor vector
     printf("%d",num[n-1]);
                    ^
prog.c:21:14: error: subscripted value is neither array nor pointer nor vector
        if(num[i]==num[i+1])
              ^
prog.c:21:22: error: subscripted value is neither array nor pointer nor vector
        if(num[i]==num[i+1])
                      ^
prog.c:22:19: error: expected ';' before 'numlen'
           current numlen++;
                   ^~~~~~
prog.c:23:19: error: subscripted value is neither array nor pointer nor vector
        else if(num[i]!=num[i+1])
                   ^
prog.c:23:27: error: subscripted value is neither array nor pointer nor vector
        else if(num[i]!=num[i+1])
                           ^
prog.c:24:19: error: expected ';' before 'num'
           current num=num[i+1];
                   ^~~
prog.c:26:25: error: expected ')' before 'numlen'
     printf("%d",current numlen);
                         ^~~~~~
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int x,max=0,min=0,size=0;
** * * * * ** *** ** ******* ****** * ** *
* ****** ****** ** ** arr[x],amount[x];
*********** *** *** * i;
* * ** * *** * * ** ** ** ** * * **
* * * *** * **** * *** * * * ** **** ** *** ** ** ** * *** ***
**** *** ******** ** *****
    int j;
* * *** * * *** * * * * ***
    {
* **** * *** * * * ** * * ** * * * * **** ** * *
***** * * ** *** * * ** *** * * * ** * ** ****
* **** * * ** * ** * * ** *** ** * * * * *
*** **** * * * * *** ** * * ************* * **** * * ** * ** * **
    }
** **** * * * * ** ** * ** *** *
    {
** * ** * * ** * * * *** * * * ** * ***** ** * **** ** * *
** * *** ** * ***** * *** * ** ****
* * ** ***** ******* *** *** *** * * * *** ** *** * *** * * * ** * ***** *
* * * ** * * * **** ********* * * * * *** * * * * *** * ** ** ** * * ** *** **
* *** * ** ** * * * * * ** * * * *
    }
    int temp=0;
*** **** ** * * *** * * * ** *** * *
    {
** * * * *** * * ** * ****** ** ** * * * * ** * * * ** ** * ** *** * * * ** *
**************** * * * ** **** ** * ** *** ** * ** **
** *** *** *** *** * ** ** * ******** * * * ** ** * * *** ** ** * * **
**** ** * *** * ** * * *** * ** *** **** *** *** * *** ** ***** * * * *
* ** * ** **** ***** ** * * * * ***** ** *
    }
* * * ** * * * **** * ** %d %d\n",max,min,arr[size]);
* **** ** * * * * * 0;
}
answered by (196 points)
edited by
0 0
Case 0: Wrong output
0 0
prog.c: In function 'main':
prog.c:9:16: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'char *' [-Wformat=]
        scanf("%d",&arr[i]);
                ^
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:108.162.241.184
©2016-2025

Related questions

2 like 0 dislike
5 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38942 - Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 2.3k views
2 like 0 dislike
18 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38941 - Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 6.2k views
3 like 0 dislike
16 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38939 - Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 6.7k views
3 like 0 dislike
12 answers
[Exam] asked Dec 23, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38938 - Available when: 2017-12-23 09:00 - Due to: 2017-12-23 12:10
| 4.8k views
2 like 0 dislike
3 answers
[Normal] Coding (C) - asked Dec 20, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 38168 - Available when: Unlimited - Due to: Unlimited
| 1.4k views
12,783 questions
183,442 answers
172,219 comments
4,824 users