HR30 Day 1: Data Types

1 개요[ | ]

Day 1: Data Types
해커랭크 30 Days of Code
문제 풀이
0-9 Day e
HR30 Day 0: Hello, World.

HR30 Day 1: Data Types

HR30 Day 2: Operators

HR30 Day 3: Intro to Conditional Statements

HR30 Day 4: Class vs. Instance

HR30 Day 5: Loops

HR30 Day 6: Let's Review

HR30 Day 7: Arrays

HR30 Day 8: Dictionaries and Maps

HR30 Day 9: Recursion

2 C[ | ]

    int i2;
    double d2;
    char s2[100];
    scanf("%d", &i2);
    scanf("%lf", &d2);
    scanf(" %[^\n]", s2);
    printf("%d\n", i+i2);
    printf("%.1f\n", d+d2);
    printf("%s%s\n", s, s2);

3 C++[ | ]

    int i2;
    double d2;
    string s2;
    cin >> i2;
    cin >> d2;
    getchar();
    getline(cin, s2);
    cout << i + i2 << endl;
    cout.precision(1);
    cout << fixed << d + d2 << endl;
    cout << s + s2 << endl;

4 Java[ | ]

<Source lang='java'>

       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);

</syntaxhighlight>

5 node.js[ | ]

    var i2 = parseInt(readLine());
    var d2 = parseFloat(readLine());
    var s2 = readLine();
    console.log(i+i2);
    console.log((d+d2).toFixed(1));
    console.log(s+s2);

6 PHP[ | ]

$i2 = intval(fgets($handle));
$d2 = floatval(fgets($handle));
$s2 = fgets($handle);

echo $i+$i2 . "\n";
echo number_format($d+$d2, 1) . "\n";
echo $s.$s2;

7 Python[ | ]

i2 = int(input())
d2 = float(input())
s2 = input()

print( i + i2 )
print( d + d2 )
print( s + s2 )
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}