Computer Science, asked by Nekomata, 1 day ago

Write a program to generate all the even numbers lying between 1 and 20 using while loop in C++​

Answers

Answered by BrainlyProgrammer
8

Answer:

#include <iostream>

using namespace std;

int main() {

int i=2;

while(i<=40){

cout<<i<<endl;

i+=2;

}

return 0;

}

Hint:-

  • Initialise I=2
  • Open while loop with condition I<=40
  • print I
  • increase I by 2
  • close while
  • Yay! you made it!!
Attachments:
Answered by BrainlyPARCHO
0

\large { \fcolorbox{gray}{black}{ ✔\: \textbf{Verified \: answer}}}

Attachments:
Similar questions