#25455: 耶


810161@lzsh.tc.edu.tw (李信遠 vicky)

School : No School
ID : 148120
IP address : [114.46.207.130]
Last Login :
2021-06-06 20:11:12
d490. 我也愛偶數 -- 板橋高中教學題 | From: [114.46.210.49] | Post Date : 2021-05-22 17:56

#include<iostream>

using namespace std;

int main ()

{

int a,b,sum=0;

cout<<"輸入兩整數";

cin>>a>>b;

for(int i=a;i<=b;i++)

if(!(i%2))

sum+=i;

cout<<"兩整數間的偶數和為"<<sum;

return 0; 

}

 
ZeroJudge Forum