“Menambahkan 2 variabel di java” Kode Jawaban

Menambahkan 2 variabel di java

public class sum{
	Public static void main(String args[]){
    	int x=5;
      	int y=10;
      	int sum= x+y;
      System.out.println("addition of x and y= "+sum);
    }
}
Comfortable Capuchin

Tambahkan dua variabel di java

public class Addition{
  	//simple addition method in Java
	public static void main(String args[]){
    	int x = 1; // initializing first variable with a value
      	int y = 3; // initializing second variable
      	
      	int sum = x + y; // new variable which is adding two variables x and y
      	
      	System.out.println( x + " + " + y + " = " + sum );
      	// printing the sum of variable on the console
    }
}
Zealous Zebra

Jawaban yang mirip dengan “Menambahkan 2 variabel di java”

Pertanyaan yang mirip dengan “Menambahkan 2 variabel di java”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya