Sort by

recency

|

3975 Discussions

|

  • + 0 comments

    //in c

    include

    include

    include

    include

    int main() { int i = 4; double d = 4.0; char s[] = "HackerRank "; int j; double k; char s1[100]; scanf("%d",&j); scanf("%lf",&k); getchar(); fgets(s1,sizeof(s1),stdin); printf("%d\n",i+j); printf("%.1lf\n",k+d); printf("%s%s\n",s,s1);

    return 0;
    

    }

  • + 0 comments
    1. import java.io.*;
    2. import java.util.*;
    3. import java.text.*;
    4. import java.math.*;
    5. import java.util.regex.*;
      1. public class Solution {
      1. public static void main(String[] args) {
    6. int i = 4;
    7. double d = 4.0;
    8. String s = "HackerRank ";
      1. Scanner scan = new Scanner(System.in);
    9. int a= scan.nextInt();
    10. System.out.println(a+i);
    11. double b=scan.nextDouble();
    12. System.out.println(b+d); 19 scan.nextLine(); // For clear buffer
    13. String c=scan.nextLine();
    14. System.out.println(s+c);
      1. scan.close(); } }
  • + 0 comments

    /* Declare second integer, double, and String variables. / int i2; double d2; String s2; / Read and save an integer, double, and String to your variables./ i2 = scan.nextInt(); d2 = scan.nextDouble(); scan.nextLine(); s2 = scan.nextLine(); / Print the sum of both integer variables on a new line. / System.out.println(i + i2); / Print the sum of the double variables on a new line. / System.out.println(d + d2); / Concatenate and print the String variables on a new line; the 's' variable above should be printed first. */ System.out.println(s.concat(s2));

  • + 0 comments

    Javascript solution for those whoo need help

    { // Predefined variables

    var i = 4;  // Integer
    var d = 4.0;  // Double
    var s = "HackerRank ";  // String
    
    // Read input values
    
    let num = parseInt(readLine());  // Read integer from input
    let myDouble = parseFloat(readLine());  // Read double from input
    let myString = readLine();  // Read string from input
    
    // Print the sum of both integer variables
    let sum = num + i;
    console.log(sum);
    
    // Print the sum of both double variables, rounded to 1 decimal place
    
    let sum1 = myDouble + d;
    console.log(sum1.toFixed(1));  // Print with one decimal place
    
    // Concatenate and print the String variables
    
    let newString = s + myString;
    console.log(newString);
    

    }

  • + 0 comments

    import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;

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

    // BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); /* Declare second integer, double, and String variables. / int var1=i; double var2=d; String var3=s; / Read and save an integer, double, and String to your variables.*/ var1+=scan.nextInt(); var2+=scan.nextDouble(); scan.nextLine(); var3+=scan.nextLine(); // Note: If you have trouble reading the entire String, please go back and review the Tutorial closely.

        /* Print the sum of both integer variables on a new line. */
    

    System.out.println(var1); System.out.println(var2); System.out.println(var3);

        /* Print the sum of the double variables on a new line. */
    
        /* Concatenate and print the String variables on a new line; 
            the 's' variable above should be printed first. */
    
        scan.close();
    

    } }