Abdalla Elawad

Abdalla Elawad

  • NA
  • 1k
  • 215.3k

how to sum even numbers less than entry number ?

Aug 5 2018 1:43 AM
hi guys 
please help me
 
This is program use c++  i need to sum numbers less than entry numbers i try to print even numbers less than entry but how to sum it ? 
 
#include
using namespace std;
int main() {
/* Initialize i with 1. */
int i;
int n ;
cout << "Enter Number : ";
cin >> n; //take user input
/* If i is less than or equal to 100. */
while( i <= n){
/* If number is divisible by 2, then print.*/
if(i % 2 == 0){
cout <
}
/* Increment i. */
i++;
}
return 0;
}
 

Answers (5)