1 solutions

  • 0
    @ 2025-11-5 16:11:16

    C :

    #include<stdio.h>
    int main(){
    	int n,i=1,a;
    	int mul=0;
    	scanf("%d",&n);
    	while(1){
    		scanf("%d",&a);
    		if(a%2==0)
    			mul+=a;
    		i++;
    		if(i>n)
    			break;
    	}
    	printf("%d",mul);
    return 0;
    }
    

    C++ :

    #include<iostream>
    using namespace std;
    int main()
    {
    	int n;
    	cin>>n;
    	int x,ans=0;
    	for (int i=1; i<=n; i++)
    	{
    		cin>>x;
    		if (x%2==0) ans+=x;
    	}
    	cout<<ans<<endl;
    	return 0;
    }
    
    • 1

    2000年秋浙江省计算机等级考试二级C 编程题(1)

    Information

    ID
    17552
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By