The function of the following program is to read 20 integers, count the number of non-negative numbers, and calculate the sum of non-negative numbers. Complete the code. 输入20个整数,统计非负数的个数,以及非负数的和。#include "stdio.h"main(){ int i,a[20],s,count;s=count=0;for(i=0;i<20;i++ )scanf("%d", ① ); // for(i=0;i<20;i++){ if(a[i]<0)②; // s+=a[i];count++;}printf("s=%d\t count=%d",s,count);}
发布时间:2024-06-08 21:57:22