Computer Science, asked by testsix6989, 1 year ago

Write a c++ program to display integer from 1 to 10 except 6 and 9

Answers

Answered by p1998
3
#include <iostream>
using namespace std;

int main()
{
for (int i = 1; i <= 10; ++i)
{
if ( i == 6 || i == 9)
{
continue;
}
cout << i << "\t";
}
return 0;
}
Answered by varshamittal029
0

Concept:

If a specified condition becomes true, then the continue statement breaks one iteration (in the loop) and continues the next iteration.

Program:

Write a c++ program to display integers from 1 to 10 except 6 and 9.

Solution:

#include <iostream>

using namespace std;

int main()

{cout << "List of integers from 1 to 10 except 6 and 9: "<< "\n";

for (int num = 1; num <= 10; num++)

   {if ( num == 6 || num == 9)

       {continue;

       }

   cout << num << "\n";

   }

return 0;

}

Output:

Attachments:
Similar questions