Answer to Question #318865 in C++ for Third 3

Question #318865

Print out all numbers from 1 to 100 that is divisible by 3 using a for loop just like the last problem, but this time, with each number only separated by the space like that of the sample output.

1
Expert's answer
2022-03-28T14:52:12-0400
#include <iostream>




using namespace std;




int main() {
    for(int i=1;i<=100;i++)
    {
        if (i % 3 == 0) {
            cout << i<<" ";
        }
    }


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog