#include void all(float a){ printf("%f ", a); } void positive(float b){ if(b > 0){ printf("%f ", b); } } float totalNegative(float c){ float c0 = 0; if(c < 0){ c0 = c; } return c0; // cho fix bug :x } void main(){ int i, j; float s = 0; float n[7]; for(i = 0; i < 7;){ i++; printf("input n[%d]: ", i); scanf("%f", &n[i]); } printf("\nAll numbers: "); for(i = 0; i < 7;){ i++; all(n[i]); } printf("\nAll positive numbers: "); for(i = 0; i < 7;){ i++; positive(n[i]); } printf("\nTotal Negative numbers: "); for(i = 0; i < 7;){ i++; s += totalNegative(n[i]); } printf("%f", s); printf("\nSort: "); for(i = 0; i < n; i++){ for(j = n-1; j > i; j--){ if(n[j] > n[j-1]){ int temp = n[j]; n[j] = n[j-1]; n[j-1] = temp; } } } for(i = 0; i < 7;){ i++; printf("%f ", n[i]); } }