JAVA programavimas (BIT)
Pavyzdys
package pirma;
import java.util.Scanner;
public class Vykdymas {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int ilgis, plotis;
double kaina, suma;
System.out.print("Iveskite ilgi, ploti ir kaina: ");
ilgis=in.nextInt();
//System.out.print("Iveskite ploti: ");
plotis=in.nextInt();
//System.out.print("Iveskite kaina: ");
kaina=in.nextDouble();
suma=ilgis*plotis*kaina;
System.out.println("Viso kainuos "+suma);
in.close();
/*
Scanner in = new Scanner(System.in);
int x, y, ats;
System.out.print("Iveskite x: ");
x=in.nextInt();
System.out.print("Iveskite y: ");
y=in.nextInt();
ats= x + y;
System.out.print("Suma: "+ats);
in.close();
*/
/*
Scanner in = new Scanner(System.in);
System.out.print("Iveskite x: ");
int x=in.nextInt();
System.out.print("Iveskite y: ");
int y=in.nextInt();
int ats= x + y;
System.out.print("Suma: "+ats);
*/
}
}
import java.util.Scanner;
public class Vykdymas {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int ilgis, plotis;
double kaina, suma;
System.out.print("Iveskite ilgi, ploti ir kaina: ");
ilgis=in.nextInt();
//System.out.print("Iveskite ploti: ");
plotis=in.nextInt();
//System.out.print("Iveskite kaina: ");
kaina=in.nextDouble();
suma=ilgis*plotis*kaina;
System.out.println("Viso kainuos "+suma);
in.close();
/*
Scanner in = new Scanner(System.in);
int x, y, ats;
System.out.print("Iveskite x: ");
x=in.nextInt();
System.out.print("Iveskite y: ");
y=in.nextInt();
ats= x + y;
System.out.print("Suma: "+ats);
in.close();
*/
/*
Scanner in = new Scanner(System.in);
System.out.print("Iveskite x: ");
int x=in.nextInt();
System.out.print("Iveskite y: ");
int y=in.nextInt();
int ats= x + y;
System.out.print("Suma: "+ats);
*/
}
}
Paskutinį kartą modifikuota: Pirmadienis, 2020 sausio 20, 17:58