Advertisement
langbung01

convert string to int and double

May 4th, 2019
771
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 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 ConsoleApp7
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string num1 = "15";
  14.             string num2 = "20";
  15.             int sum = int.Parse(num1) + int.Parse(num2);
  16.  
  17.             double sumD = double.Parse(num1) + double.Parse(num2);
  18.             Console.WriteLine(sum);
  19.             Console.WriteLine(sumD);
  20.             Console.Read();
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement