Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. public class gallon2Liters {
  2. public static void main(String[] args){
  3. double gallons;
  4. double liters;
  5. int counter = 100;
  6.  
  7. for (int i = 1; i < counter; i++){
  8. gallons = i;
  9. liters = gallons * 3.7854;
  10. System.out.println(gallons + " gallons is " + liters + " liters");
  11. if(i%10 == 0){
  12. System.out.println("");
  13. }
  14. }
  15. }
  16. }
  17.  
  18. public class teefee {
  19. public static void main(String[] args) {
  20. teeFee(30);
  21.  
  22. }
  23. public static void teeFee(int x){
  24. for (int i = 1; i <= x; i++) {
  25. boolean teeOrFee = false;
  26. if (i % 3 == 0) {
  27. System.out.print("T");
  28. teeOrFee = true;
  29. }
  30. if (i % 5 == 0) {
  31. System.out.print("F");
  32. teeOrFee = true;
  33. }
  34.  
  35. if (teeOrFee) {
  36. System.out.println();
  37. } else {
  38. System.out.println(String.valueOf(i));
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement