C++ Forloops
the purpose of this program is to practice for loops and do commands until they've been completed,
program code: replit.com/@JasmunnD1/jasmunnlooooops#main.cpp
program code: replit.com/@JasmunnD1/jasmunnlooooops#main.cpp
jasmunnlooooops.zip |
cout << "\nquestion 1 display numbers from 1 to 25\n\n";
for (int x = 1; x <= 25; x = x + 1)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 2 display numbers from 2 to 8\n\n";
for (int x = 2; x <= 8; x = x + 1)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 3 display numbers from 50 to 100\n\n";
for (int x = 50; x <= 100; x = x + 1)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 4 display numbers from 1 to 75 by 4\n\n";
for (int x = 1; x <= 75; x = x + 4)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 5 Counting from 36 to 600 by 15\n\n";
for (int x = 36; x <= 600; x = x + 15)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 6 Counting from -25 to 105 by 7\n\n";
for (int x = -26; x <= 105; x = x + 7)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 7 Counting from -350 to 350 by 8\n\n";
for (int x = -350; x <= 350; x = x + 8)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 8 Counting from 100 to 1 by 1\n\n";
for (int x = 100; x >= 1; x = x - 1)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 9 Counting from 1000 to 700 by 5\n\n";
for (int x = 1000; x >= 700; x = x - 5)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 10 Counting from 180 TO -5 by 6\n\n";
for (int x = 180; x >= -5; x = x - 6)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 11 Counting from -30 to -600 by 25\n\n";
for (int x = -30; x >= -600; x = x - 25)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 12 The even numbers between 1 and 200 including 200\n\n";
for (int x = 1; x <= 200; x = x + 1)
if (x % 2 == 0)
cout << x << "\t";
cout << "\n Question 13 The odd numbers between 200 and 300 inclusive\n\n";
for (int x = 200; x <= 300; x = x + 1)
if (x % 2 == 1)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nQuestion 14 The numbers between 1 and 400 that are divisible by "
"7\n\n";
for (int x = 1; x <= 400; x = x + 1)
if (x % 7 == 0)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\n question 15 The numbers between 1 and 500 that are equally "
"divisible by both 6 and 4\n\n";
for (int x = 1; x <= 500; x = x + 1)
if (x % 6 == 0 and x % 4 == 0)
cout << x << "\t";
}
for (int x = 1; x <= 25; x = x + 1)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 2 display numbers from 2 to 8\n\n";
for (int x = 2; x <= 8; x = x + 1)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 3 display numbers from 50 to 100\n\n";
for (int x = 50; x <= 100; x = x + 1)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 4 display numbers from 1 to 75 by 4\n\n";
for (int x = 1; x <= 75; x = x + 4)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 5 Counting from 36 to 600 by 15\n\n";
for (int x = 36; x <= 600; x = x + 15)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 6 Counting from -25 to 105 by 7\n\n";
for (int x = -26; x <= 105; x = x + 7)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 7 Counting from -350 to 350 by 8\n\n";
for (int x = -350; x <= 350; x = x + 8)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 8 Counting from 100 to 1 by 1\n\n";
for (int x = 100; x >= 1; x = x - 1)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 9 Counting from 1000 to 700 by 5\n\n";
for (int x = 1000; x >= 700; x = x - 5)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 10 Counting from 180 TO -5 by 6\n\n";
for (int x = 180; x >= -5; x = x - 6)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 11 Counting from -30 to -600 by 25\n\n";
for (int x = -30; x >= -600; x = x - 25)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nquestion 12 The even numbers between 1 and 200 including 200\n\n";
for (int x = 1; x <= 200; x = x + 1)
if (x % 2 == 0)
cout << x << "\t";
cout << "\n Question 13 The odd numbers between 200 and 300 inclusive\n\n";
for (int x = 200; x <= 300; x = x + 1)
if (x % 2 == 1)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\nQuestion 14 The numbers between 1 and 400 that are divisible by "
"7\n\n";
for (int x = 1; x <= 400; x = x + 1)
if (x % 7 == 0)
cout << x << "\t";
cout << "\n\n**************************\n\n";
cout << "\n question 15 The numbers between 1 and 500 that are equally "
"divisible by both 6 and 4\n\n";
for (int x = 1; x <= 500; x = x + 1)
if (x % 6 == 0 and x % 4 == 0)
cout << x << "\t";
}