Advertisement
Guest User

Untitled

a guest
Dec 11th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Preparation
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int i = 4;
  14. double d = 4.0;
  15. string s = "HackerRank ";
  16.  
  17. // Declare second integer, double, and String variables.
  18. int x;
  19. double y;
  20. string z;
  21.  
  22. // Read and save an integer, double, and String to your variables.
  23. x = int.Parse(Console.ReadLine());
  24. y = double.Parse(Console.ReadLine());
  25. z = Console.ReadLine();
  26.  
  27. // Print the sum of both integer variables on a new line.
  28. Console.WriteLine(x + i);
  29.  
  30. // Print the sum of the double variables on a new line.
  31. Console.WriteLine(string.Format("{0:0.0}", d + y));
  32.  
  33. // Concatenate and print the String variables on a new line
  34. // The 's' variable above should be printed first.
  35. Console.WriteLine(s + z);
  36. Console.ReadLine();
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement