hey,
um i was wondering if anyone could help me with a program where if the user inputs a number no more than 5 digits and the program tells you how many times the number 2 appears in that number.
i know that the modulus and division have to be used but i dont know how to set that part up
can someone help??
thanxxxx
mina1984 0 Newbie Poster
Recommended Answers
Jump to PostPost what you've got.
Jump to Postget it from the keyboard as a string instead of an integer, then create a loop to check each digit in the string. You don't need modules, division, shifts, or any other math operations, unless, of course, that is a requirement of the problem.
All 5 Replies
Dave Sinkula 2,398 long time no c Team Colleague
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
mina1984 0 Newbie Poster
chrisbliss18 26 Posting Shark
mina1984 0 Newbie Poster
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.