Crenox

CountingPeopleWhile Program

Feb 11th, 2014
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. // By: Sammy Samkough
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class CountingPeopleWhile
  6. {
  7. public static void main(String[] args)
  8. {
  9. Scanner sc = new Scanner(System.in);
  10. System.out.println("How many people are there?");
  11. int people;
  12. people = sc.nextInt();
  13. int i = 0;
  14. while (i < people)
  15. {
  16. if (i == 1)
  17. {
  18. System.out.println(i + " person has come.");
  19. }
  20. else
  21. {
  22. System.out.println(i + " people have came.");
  23. }
  24. i++;
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment