Hello(adsbygoogle = window.adsbygoogle || []).push({});

I am writing a program where program will randomly generate a three digit number from 100 to 999 and then user will be asked to guess that number. If the number is matched exactly, then the highest prize is given to the user, if all digits in a guess are also in the original number, next highest prize will be given to the user. If two digits from guess are correct, then the next prize . If one digit from the guess is correct, then the next one. Finally no prize for the guess where no digits match.

I tried to use if-else construct for this. I am able to get the first two correct. But I am having problems with logic where guess might have two of its digits correct and where guess might have only single digit correct. Any specific ideas ?

thanks

issacnewton

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Problem involving 3 digit numbers

Loading...

Similar Threads for Problem involving digit |
---|

C/++/# Problems with #include<complex.h> |

Running a multidimensional problem on a single core |

JavaScript Problem using dat.GUI controller library |

Fortran Fortran for Computational Fluid Dynamics Problems |

Hacking: Legal and Ethical Problems |

**Physics Forums | Science Articles, Homework Help, Discussion**