0
C++
How do I write a c++ program to display the sum of even numbers between 1 to 10
4 Respostas
+ 5
Harishchand Gupt Please do not give ready-made code without any explanation. It is not beneficial to the learning process. Rather support other users in finding a solution themselves.
0
#include <iostream>
using namespace std;
int main() {
int num=1,sum=0;
while(num<=10){
if(num%2==0){
sum+=num;
}
num++;
}
cout<<sum;
return 0;
}
0
Thanks
0
Ok