Monday, May 10, 2010

coding murahan...(bagi saya mahal)

package project;

import java.util.Scanner;

public class IO {

    public static void main(String[] args) {
       
        Scanner bucky = new Scanner(System.in);
        System.out.println(bucky.nextLine());
    }
}

output :
testttt
testttt

package project;

import java.util.Scanner;

public class penjumlahan {
   
    public static void main(String[] args) {
       
        Scanner bucky = new Scanner(System.in);
        double fnum,snum,answer;
       
        System.out.println(" Enter first Num : ");
        fnum = bucky.nextDouble();
        System.out.println(" Enter second Num : ");
        snum = bucky.nextDouble();
        answer = fnum + snum;   

        System.out.println(" You answer : " + answer);
       
    }

}

output :
  Enter first Num :
12
 Enter second Num :
100
 You answer : 112.0

No comments: