Answer to Question #283749 in C++ for Collay

Question #283749

3. There was a Three

by CodeChum Admin


I'm bored with just basic counting. How about we do some complex things this time? But I don't want to be associated with any number that's not divisible by 3.




Think you can handle this?






Instructions:


Print out all numbers from 1 to 100 that is divisible by 3, each in separate lines, using a for loop.

Output


Multiple lines containing an integer that is divisible by 3.


3

6

9

12

15

18

21

24

27

30

33

36

39

42

45

48

51

54

57

60

63

66

69

72

75

78

81

84

87

90

93

96

99


1
Expert's answer
2022-01-02T02:21:07-0500
#include <iostream>


using namespace std;


int main()
{
    for (int i = 1; i < 101; i++) {
        if (i%3==0) cout << i << '\n';
    }


    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