Results 1 to 3 of 3
  1. #1
    Zebra's Avatar
    Zebra is offline Member
    Join Date
    Apr 2008
    Location
    Louisville, Indiana/Kentucky
    Posts
    64
    Rep Power
    0

    Default Quotients/Remainders (Loops *Need Help*)

    Write a program that finds the quotients and remainders of all the numbers
    between 200 and 225 when they are divided by x, where x= 11 if the number
    is even and x is 14 if the number is odd. Here's what the output should
    look like.

    OUTPUT:
    Attached Thumbnails Attached Thumbnails Quotients/Remainders (Loops *Need Help*)-output-copy.jpg  
    I am a Java n00b.

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    10

    Default

    You know what?!! if you don't try to do it yourself first, you will never realize how lovable java programming is....

    An ideal forum was designed to help/discuss other members about there problem or new ideas, sharing it with them while learning....

    And not to feed them ( Posting the complete code )....

    don't be on a hurry,
    sukatoa

  3. #3
    sanjeevtarar's Avatar
    sanjeevtarar is offline Senior Member
    Join Date
    Apr 2008
    Location
    Jaipur(India)
    Posts
    319
    Rep Power
    9

    Default

    Hello Zebra,

    I think your problem is not much hard...just think about the logic and do some paper work, it will help you lot.

    First try it at your self...OK

    however i have done this.

    Java Code:
    public class FindQuotientsRemainders 
    {
    	public static void main(String[] args){
    		getNumber();
    	}
    
    	public static void getNumber(){
    		int evenX = 11;
    		int oddX = 14;
    
    		for (int i=200;i<=225;i++ ){
    			int quoti = 0,rema = 0;
    			if(i%2==0){
    				quoti = i/evenX;
    				rema = i%evenX;
    				System.out.println("When "+i+" is divided by "+evenX+", the quotients is "+quoti+" and remainders is "+rema);
    			}else{
    				quoti = i/oddX;
    				rema = i%oddX;
    				System.out.println("When "+i+" is divided by "+oddX+", the quotients is "+quoti+" and remainders is "+rema);
    			}
    		}
    	}
    }

    sanjeev

Similar Threads

  1. Question about loops
    By BHCluster in forum New To Java
    Replies: 4
    Last Post: 04-16-2008, 05:40 PM
  2. Replies: 4
    Last Post: 04-16-2008, 01:26 PM
  3. [SOLVED] Need help with Loops...please!
    By Zebra in forum New To Java
    Replies: 5
    Last Post: 04-10-2008, 01:44 PM
  4. Loops (while do etc)
    By manupr in forum New To Java
    Replies: 1
    Last Post: 01-15-2008, 04:59 AM
  5. Help me: loops in java
    By silvia in forum New To Java
    Replies: 3
    Last Post: 07-19-2007, 06:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •