201,875 views
16 votes
16 votes
What is the C++ program to display 3 6 9 12 15​

User Johnny Westlake
by
2.6k points

1 Answer

9 votes
9 votes

Answer:

#include <iostream>

using namespace std;

int main()

{

int n = 15;

for(int i=3; i<=n; i=i+3){

cout<<i;

cout<<" ";

}

return 0;

}

Step-by-step explanation:

Used for loop to calculate number and display it. for start with 3(int i=3), increment by 3(i=i+3) and stop when 15 came (i<=n where n is 15).

User Mikolasan
by
3.0k points