Hi I need to write a small program to output even numbers fr

Hi I need to write a small program to output even numbers from 2 to 10 as follow:

Run# 1: 2 4 6 8 10
Run# 2: 2 4 6 8 10
Run# 3: 2 4 6 8 10

Solution

The following code provides you the required code in C++:

#include <iostream>
using namespace std;

int main() {
   // your code goes here
   for(int i=2;i<=10;i+=2)
       cout<<i<<\" \";
   return 0;
}

Output:

2 4 6 8 10

Link of code:

http://ideone.com/8kuUkg

Hope it helps, do give your response.

Hi I need to write a small program to output even numbers from 2 to 10 as follow: Run# 1: 2 4 6 8 10 Run# 2: 2 4 6 8 10 Run# 3: 2 4 6 8 10SolutionThe following

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site