Hacker Rank - Day 1 : Data Types

                        Day 1 :Data Types.

Solution In Java 8:

import java.io.*;
import java.util.*;

public class Solution
{
    public static void main(String[] args)
    {
        int i = 4;
        double d = 4.0;
        String s = "HackerRank ";

        Scanner scan = new Scanner(System.in);
       
        int i2 = scan.nextInt();
        double d2 = scan.nextDouble();
        scan.nextLine();
        String s2 = scan.nextLine();

        System.out.println(i+i2);
        System.out.println(d+d2);
        System.out.println(s+s2);
       
        scan.close();
    
    }
}

Solution In Python 3:


no = int(input())
dno = float(input())
stri = (input())

print(i + no)
print(d + dno)
print(s + stri)

Share:

0 comments:

Post a Comment