int percent (int a, int b)
{
if (b/a*100 > 25)
return TRUE;
else
return FALSE;
}
I want to calculate what percentage of a is b.
say if b = 48, a = 100
so b is 48% of a
but wouldnt b/a give me 0 ??? what can be done ?? (6 Replies)
Hi, I am having the file which contains the following two columns.
518 _factorial
256 _main
73 _atol
52 ___do_global_ctors
170 ___main
52 ___do_g
How can calculate the percentage of each value in the first column ?
first need to get the sum of the first column and... (3 Replies)
i have 3 files like
total.dat=18
equal.dat=14
notequal.dat=16
i need find the equal percentange means:
equalpercentage = ($equal.dat / $total.dat * 100)
How i can do this ?
I tried some of the answers to calculate the percentage in this forums.but it couldn't worked.Some one please... (6 Replies)
Hi
I need a awk script to calculate percentage.
I have to pass the pararmeters in to the awk script and calculate the percentage.
Sum = 50
passed = 43
failed = 7
I need to pass these value in to the awk script and calculate the percentage.
Please advice me. (8 Replies)
A short excerpt of my .txt file looks like:
CXRA3Z2J9MQKR B
CXRA3Z2J9MQKR A
CXRA3Z2J9MQKR C
CXRA3Z2J9MQKR B
A162JX4ML69UIC C
A162JX4ML69UIC A
FZ9Z19TI2XOA5 A
FZ9Z19TI2XOA5 C
FZ9Z19TI2XOA5 B
FZ9Z19TI2XOA5 B
BRNTTJUB8GXE9 A
BRNTTJUB8GXE9 A
... (7 Replies)
hello,
please can you help me.
jj and kk are two numbers which are the result of an sql program.
I would like to calculate the ratio jj/kk*100.
I have done this:
ratio=$((jj/kk * 100)) or ratio=`expr $jj \/ expr $kk) but the result is 0
What can i do?
Thanks for help. (3 Replies)
Input File:
5081
2058
175
8282
2358
7347
6612
3459
END OF INPUT FILE
I need to know how to calculate minimum,maximum,average of the values in the file and also what percentage is the values over some user defined value for example 1000 and what percentage of value is over 5000.
By... (2 Replies)
I have 100 csv files like:
file_city_1 file_city_2 file_city_3 file_city_4
City name is variable, there is 25 cities, each city has 4 region. Each of the 4 region contain some statistics like:
parameter1 : number1
parameter1 : number2
.....
parameter50 : number50
... (7 Replies)
This matrix represents correlation values.
Is it possible to calculate the percentage of columns (a1, a2, a3) that have a value >= |0.5| and report the percentage that has positive correlation >0.5 and negative correlation <-0.5 separately. thanx in advance!
input
name a1 a2 a3... (5 Replies)
I have a input text file in this format:
ITEM1 10.9 20.1
ITEM2 11.6 12
ITEM3 14 15.7
ITEM5 20 50.6
ITEM6 25 23.6
I want to print those lines which have more than 5% difference between second and third columns. (8 Replies)
Discussion started by: ctrld
8 Replies
LEARN ABOUT PHP
min
MIN(3) 1 MIN(3)min - Find lowest valueSYNOPSIS
mixed min (array $values)
DESCRIPTION
mixed min (mixed $value1, mixed $value2, [mixed $...])
If the first and only parameter is an array, min(3) returns the lowest value in that array. If at least two parameters are provided,
min(3) returns the smallest of these values.
Note
Values of different types will be compared using the standard comparison rules. For instance, a non-numeric string will be com-
pared to an integer as though it were 0, but multiple string values will be compared alphanumerically. The actual value returned
will be of the original type with no conversion applied.
PARAMETERS
o $values
- An array containing the values.
o $value1
- Any comparable value.
o $value2
- Any comparable value.
o $...
- Any comparable value.
RETURN VALUES min(3) returns the parameter value considered "lowest" according to standard comparisons. If multiple values of different types evaluate as
equal (e.g. 0 and 'abc') the first provided to the function will be returned.
EXAMPLES
Example #1
Example uses of min(3)
<?php
echo min(2, 3, 1, 6, 7); // 1
echo min(array(2, 4, 5)); // 2
// The string 'hello' when compared to an int is treated as 0
// Since the two values are equal, the order they are provided determines the result
echo min(0, 'hello'); // 0
echo min('hello', 0); // hello
// Here we are comparing -1 < 0, so -1 is the lowest value
echo min('hello', -1); // -1
// With multiple arrays of different lengths, min returns the shortest
$val = min(array(2, 2, 2), array(1, 1, 1, 1)); // array(2, 2, 2)
// Multiple arrays of the same length are compared from left to right
// so in our example: 2 == 2, but 4 < 5
$val = min(array(2, 4, 8), array(2, 5, 1)); // array(2, 4, 8)
// If both an array and non-array are given, the array is never returned
// as comparisons treat arrays as greater than any other value
$val = min('string', array(2, 5, 7), 42); // string
// If one argument is NULL or a boolean, it will be compared against
// other values using the rule FALSE < TRUE regardless of the other types involved
// In the below examples, both -10 and 10 are treated as TRUE in the comparison
$val = min(-10, FALSE, 10); // FALSE
$val = min(-10, NULL, 10); // NULL
// 0, on the other hand, is treated as FALSE, so is "lower than" TRUE
$val = min(0, TRUE); // 0
?>
SEE ALSO max(3), count(3).
PHP Documentation Group MIN(3)