Tugaspemilihansultanfor.txt

  • Uploaded by: Oskar Pra
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Tugaspemilihansultanfor.txt as PDF for free.

More details

  • Words: 98
  • Pages: 1
import java.util.Scanner; public class tugasPemilihanSultanFor { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int inputAngka, hitung, outputAngka; System.out.print("Masukkan angka : "); inputAngka = scan.nextInt(); outputAngka = 68; if (inputAngka <= 0) { System.out.println("Error"); } else { for (hitung = 1; hitung <= inputAngka; hitung++) { if (hitung % 2 == 0) { outputAngka += 2; } else if (hitung == 1) { outputAngka = 68; } else { outputAngka -= 1; } } if (outputAngka > 90) { System.out.println("Error"); } else { System.out.println("Hasil Output adalah : " + (char) outputAngka); } } }

}

More Documents from "Oskar Pra"