Nejvyšší ze tří čísel


/ Published in: Java
Save to your folder(s)

Napište program, který vybere nejvyšší ze tří čísel.


Copy this code and paste it in your HTML
  1. package sbirka.uloh;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Cviceni­2{
  6. public static void main(String[] args){
  7. Scanner sc = new Scanner(System.in);
  8. System.out.println("Zadej postupne tri cisla, po kazdem stiskni ENTER");
  9. int pomocna = 0;
  10. for(int i = 0; i < 3; i++){
  11. int a = sc.nextInt();
  12. if(a > pomocna){
  13. pomocna = a;
  14. }
  15. }
  16. System.out.println("Nejvyssi ci­slo je: " + pomocna);
  17.  
  18.  
  19. }
  20. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.