Advertisement
Dilyana86

Untitled

May 24th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2.  
  3. namespace dataTypes
  4. {
  5.     public class floatOrInteger
  6.     {
  7.         public static void Main()
  8.         {
  9.             var num = Console.ReadLine();
  10.             var digit = 0;
  11.             foreach(var symbol in num)
  12.             {
  13.                 digit = symbol - '0';
  14.                 Console.WriteLine(digit);
  15.             }
  16.             if (digit % 1 == 0)
  17.             {
  18.                 Console.WriteLine(digit);
  19.             }
  20.             else
  21.             {
  22.                 Console.WriteLine(Math.Round(digit));
  23.             }
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement