0

Sample Input: 12, 4.0, is good for Storing data!

Expected OutPut: 16, 8.0, String is good for Storing data!

Actual Output: 16, 8.0, String

public static void main(String[] args) {

        int i = 4;
        double d = 4.0;
        String s = "string ";

        Scanner scan = new Scanner(System.in);

        int i1;
        double d1;
        String s1;
        i1 = scan.nextInt();
        d1 = scan.nextDouble();
        s1 = scan.nextLine(); // if i am add this line before taking i1 is than its working fine but here not?

        System.out.println(i + i1);
        System.out.println(d + d1);
        System.out.println(s + " " + s1);
        scan.close();
    }
Sadina Khatun
  • 812
  • 11
  • 21

0 Answers0