描述
统计一个数组中正数和负数分别的个数及所有元素值的总和,并找到绝对值最大和最小的两个元素。
关于输入
输入数组元素个数n(n<=100)
输入n个整数
关于输出
依次输出数组中正、负数个数,数组总和,绝对值最大、最小的元素。
例子输入
6
20 -35 44 -2 79 12
例子输出
4
2
118
79
-2
#include <stdio.h>
int main() {
int n = 0;//the number of array elements
scanf("%d\n", &n);
int i = 0;
int t = 0;//the element
int sum = 0;//summary
int pos_num = 0; int neg_num = 0;//the number of positive and negative number
int array[101] = {
0 };