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....

Recommended Answers

All 2 Replies

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

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.