Answer to Question #258440 in Java | JSP | JSF for mark angelou

Question #258440

We Filipinos are quite known for the habit of leaving at least one of the many pieces of food on the plate as it can't be equally divided among all at most times. Just like when 3 people decide to eat a pizza of 10 slices, there will often be at least one slice left on the box. To accurately show just how many pieces of things are left when divided by a certain number, we code it using modulo.

Care to do it for me?


1
Expert's answer
2021-10-29T06:15:22-0400
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
	    Scanner in=new Scanner(System.in);
		System.out.println("Enter number of pieces: ");
		int num_pieces=in.nextInt();
		System.out.println("Enter number of people: ");
		int num_people=in.nextInt();
		
		int rem=num_pieces%num_people;
		System.out.println("Number of pieces remaining = "+rem);
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS