0

C++

How do I write a c++ program to display the sum of even numbers between 1 to 10

24th Feb 2023, 10:10 AM
Emmanuel igbojionu
Emmanuel igbojionu - avatar
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.
24th Feb 2023, 11:44 AM
Lisa
Lisa - avatar
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; }
24th Feb 2023, 11:15 AM
Harishchand Gupt
0
Thanks
24th Feb 2023, 11:35 AM
Emmanuel igbojionu
Emmanuel igbojionu - avatar
0
Ok
24th Feb 2023, 1:07 PM
Harishchand Gupt