7.2.. Od dva učitana broja (a, b) sa tastature naći manji min(a, b).
Listing programa:
package Zadatak;
import java.util.Scanner;
public class P07211039 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Unesi dva broja");
int a = input.nextInt();
int b = input.nextInt();
int min;
if (a < b)
min = a;
else
min = b;
System.out.print("min=" + min);
}
}
Ispis na ekranu:
Index
|