Sort by

recency

|

3978 Discussions

|

  • + 0 comments

    c#

    Console.Write((i+Convert.ToInt32(Console.ReadLine()))+"\n"+(d+Convert.ToDouble(Console.ReadLine())).ToString("F1")+"\n"+s+Console.ReadLine());

  • + 0 comments

    nextLine read leftovers also so after gving input of double we press enter nextLine reads it and returns empty so we need to add 1 more nextLine so that it can read the line we typed after pressing enter ( our input string ).

    so we write it like: scan.nextLine(); // to clear buffer String str = scan.nextLine();

  • + 0 comments

    //in c++

    /*
        cout<<4+integer_num<<'\n';
        cout<<fixed<<setprecision(1)<<4.0+double_num<<'\n';
        cout<<"HackerRank "+String<<'\n';
    */
    
  • + 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(); } }