Jump to content

Need Help! Java or Ada95 anyone?

- - - - -

  • Please log in to reply
1 reply to this topic

#1
willmann817

willmann817

    Newbie

  • Members
  • Pip
  • 1 posts
This is an assignment for a programming class that I am taking. I do not need anyone to write code for me. I am just a bad problem solver and need help on the logic for this problem. I do not even know how to solve this problem by hand so if someone can give me a good hint or get me started in the right direction I will be in good shape to code it myself. The assignment is as follows:

"My brother has more than a touch of OCD. He was born in 1977 on July 7th (7/7/77), and has always been obsessed with the number 7. Recently, I bought him a roll of consecutively numbered raffle tickets. He carefully inspected each raffle ticket, setting aside those with numbers ending in 7. Write a function that takes the numbers of the first and last tickets in the roll, and determines how many tickets he kept. "

(It is possible to write a mathematical formula to spit out the answer, but don't try. The point of this problem is to practice iteration. )

(Hint: You will find the built-in rem operator useful.)

Thanks for your help,
willmann817

#2
Ritwik I the programmer

Ritwik I the programmer

    Newbie

  • Members
  • PipPip
  • 17 posts
Simple. Run afor loop from the first to the last number, and check which numbers give seven as remainder when divided by ten using the remainder operator(for java, it is %).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users