0

Make a program that counts, identifying every value divisible by 3 and 5. If it is divisible by 3, put an asterisk (*) beside it. If it is divisible by 5, put a tilde (~) beside it. Print the first 200 values.

Can someone help me? i don't actually know how to this... Im new in C++ still learning....

3
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by 2teez
0

Yes we can, if you help us understand your difficulty.

All it takes is a FOR statement and the % (modulus) operator.

Edited by WaltP

0

Hi,
You might be new to C++, but probabily not new to programming in general. If so, write solve the problem using the programming lang. you know, then try it out using the C++ syntax you have learnt so far.
Here is a psuedo code:

define and initialise a counter,
using a for loop, define and initialise a value,set the value boundary and loop,
test if the counter is equal to 200,
if yes, exit the for loop,
if no, 
check if the value is divisible by 3,
if yes, print out the value and increase the value of counter by 1
check if the value is divisible by 5,
if yes, print out the value and increase the value of counter by 1

If you have any difficulties people are willing to help.
Hope this helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.