Advertisement
ZazoTazo

Houses

Jun 24th, 2019
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner input = new Scanner(System.in);
  9.         System.out.print("Enter house number (1-6): ");
  10.         int houseNumber = input.nextInt();
  11.         System.out.print("Enter steps number: ");
  12.         int stepsNumber = input.nextInt();
  13.         int counter = houseNumber;
  14.         for(int i = 0; i < stepsNumber; i++){
  15.             counter++;
  16.         }
  17.         if(counter%6 == 0){
  18.             System.out.println("You are at house " + 6);
  19.         }
  20.         else{
  21.             System.out.println("You are at house " + ((counter%6)));
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement