#25138: fish i'm comming!


yp10870709 (˙_____˙)

School : 臺北市私立延平高級中學
ID : 104339
IP address : [111.235.252.96]
Last Login :
2021-04-23 15:24:47
a038. 數字翻轉 | From: [111.235.252.96] | Post Date : 2021-04-23 15:33

 

#include<iostream>

using namespace std;

 

int main()

{

int n,m,i,sum=0;

cout<<"請輸入起始值及終止值";

cin>>n>>m; 

if(n%2==0) n++;

i=n;

while(i<=m){

sum+=i; 

i+=2;

}

 

 

cout<<sum;

return 0;

 }

 

 
ZeroJudge Forum