Friday, June 4, 2021

program calculate the sum of the all even number (POP) (131)

#include<iostream>

using namespace std;

int main()

{

int i,num,sum=0;

cout<<"please enter your number:";

cin>>num;

for(i=1;i<=num;i++)

{

cout<<i*2<<endl;

sum=sum+i*2;

}

cout<<"the sum of the all even  number is:"<<sum<<endl;

} 

No comments:

Post a Comment