Posted by: Nas September 16, 2006
Java help
Login in to Rate this Post:     0       ?        
/ * C++ Program that prompts user to input 4 digits between the range of 1000 and 9999 and outputs the digits one per line. Very inefficient algorithm but works perfectly. Please look at the algorithm. It would be same for the Java. Basically you just have to use Divison and Modolus operation. Initially, I tried to input the 4 digits in an array (somehow !) and return the index value but could not figure it out how to. You might wanna do that too. Author : Nas :) */ #include using namespace std; main(){ cout<<"Please input 4 digits : "; int input; cin>>input; if(input<1000 || input>9999){ cout<<"Please input 4 digits between 1000 and 9999 only. "<
Read Full Discussion Thread for this article