(C syntax) Select the largest number from n and the number of syntaxes.
Knowledge point:
Flexible array use
Flexible Use of for Loops
Simple Algorithms
Content: select the maximum number from n.
Input description:
Two rows
Number n of the first row, indicating the total number
The second line contains n numbers separated by spaces.
Output description:
One row, Max
Input example:
4 1 2 3 4
Output example:
4
#include <stdio.h>
#define MAX 200int main(){ int a[MAX],n,i,t; scanf("%d",&n); for (i=0;i<n;i++) { scanf("%d",&a[i]); } for (i=1;i<n;i++) { if (a[0]<a[i]) { a[0]=a[i]; } } printf("%d\n",a[0]); return 0;}
In excel, how can I pick out some data that needs to be selected from a column of numerous data?
You can use the vlookup function.
VLOOKUP Function
Find the specified value in the first column of the table or value array, and return the value at the specified column in the row of the value in the table or array.
The "array" mentioned here can be understood as a region in the table. Column Number of the array: "First column" of the array, which is the first column of the region. The right column of this column is 2nd columns and 3 columns in sequence ....... Assume that an array is B2: E10, so B2: B10 is 1st columns and C2: C10 is 2nd columns .......
Syntax:
VLOOKUP (search value, region, column number, logical value)
"Search value": the value to be searched in the first column of the array. It can be a value, reference, or text string.
"Region": the region where the array is located, such as "B2: E10". You can also use a reference to the region or region name, such as a database or data list.
"Column number": the column number of the value to be returned in the expected region (array). If it is 1, the value in the first column is returned. If it is 2, the value in the second column is returned, similarly, if the column number is smaller than 1, The VLOOKUP function returns the error VALUE # VALUE !; If the number of columns exceeds the range, the function VLOOKUP returns an error value # REF !.
"Logical value": TRUE or FALSE. It specifies whether the VLOOKUP function returns exact or approximate match. If the value is TRUE or omitted, the approximate matching value is returned. That is to say, if the exact matching value cannot be found, the maximum value smaller than the "Search value" is returned. If the "logical value" is FALSE, the VLOOKUP function returns the exact matching value. If no value is found, an error value # N/A is returned. If "Search value" is text, "logical value" should generally be FALSE. In addition:
· If the "Search value" is smaller than the minimum value in the first column of "region", the function VLOOKUP returns the error value # N/.
· If the function VLOOKUP cannot find the "Search value" and the "logical value" is FALSE, the function VLOOKUP returns the error value # N/.
The following example describes how to use the VLOOKUP function.
Assume that the unit prices of wheat, rice, corn, peanut and other agricultural products are stored in Sheet1:
A B
1 agricultural product name unit price
2. Wheat 0.56
3. Rice 0.48
4. Corn 0.39
5 peanut 0.51
.......................................
100 soybean 0.45
Sheet2 is the sales list. The configuration content is different each time: Enter the agricultural product name and quantity in Sheet2, and then automatically generate the unit price and sales amount based on the data of sheet1. Set the following table to Sheet2:
A B C D
1. Agricultural Product Name quantity unit price
2. Rice 1000 0.48 480
3. Maize 2000 0.39 780
.........................................................
Enter the formula in cell D2:
= C2 * B2;
Enter the formula in cell C2:
= VLOOKUP (A2, Sheet1! A2: B100, 2, FALSE ).
If it is expressed in a language, the system searches for the A2 value of table Sheet2 in the first column of Table A2: B100 in Table Sheet1. After finding the value, the system returns the value of Column 2nd in this row.
In this way, when the name entered in cell A2 of table Sheet2 changes, the unit price in Table C2 automatically changes. Of course, for example, Sheet... the remaining full text>
Quick data selection in excel
It seems that there is no simple method to calculate directly.
Let me give you a try:
Use "data" => "filter" on the menu first"
Filter data of less than 100, put a column separately, and sort data from 1 to 100.
Then, filter the data from 1185.4 to 1085.4 and put a column separately, sorted from 1185.4 to 1085.4.
Sort by others in sequence
I think this can be implemented using excel vba, but I won't. I can help you write a program using ASP.