Advertisement
Guest User

Untitled

a guest
Jan 28th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.93 KB | None | 0 0
  1. using System;
  2.     using System.Collections.Generic;
  3.     using System.Linq;
  4.     using System.Globalization;
  5.  
  6.     public class PhotoGallery
  7.     {
  8.         public static void Main()
  9.         {
  10.             var photoNumbers = int.Parse(Console.ReadLine());
  11.             var day = int.Parse(Console.ReadLine());
  12.             var month = int.Parse(Console.ReadLine());
  13.             var year = int.Parse(Console.ReadLine());
  14.             var hours = int.Parse(Console.ReadLine());
  15.             var minutes = int.Parse(Console.ReadLine());
  16.             var photoSize = decimal.Parse(Console.ReadLine());
  17.             var photoWidth = int.Parse(Console.ReadLine());
  18.             var photoHeight = int.Parse(Console.ReadLine());
  19.  
  20.  
  21.             var date = ($"{day:d2}/{month:d2}/{year:d4} {hours:d2}:{minutes:d2}");
  22.             var resolution = string.Empty;
  23.             var humanReadableSize = string.Empty;
  24.  
  25.             if (photoWidth < photoHeight)
  26.             {
  27.                 resolution = "portrait";
  28.             }
  29.             else if (photoWidth > photoHeight)
  30.             {
  31.                 resolution = "landscape";
  32.             }
  33.             else
  34.             {
  35.                 resolution = "square";
  36.             }
  37.  
  38.  
  39.  
  40.             if(photoSize < 1000)
  41.             {
  42.                 humanReadableSize = "B";
  43.             }
  44.             else if (photoSize < 1000000)
  45.             {
  46.                 humanReadableSize = "KB";
  47.                 photoSize = Math.Round((photoSize / 1000), 1);
  48.             }
  49.             else
  50.             {
  51.                 humanReadableSize = "MB";
  52.                 photoSize = Math.Round((photoSize / 1000000), 1);
  53.             }
  54.  
  55.             Console.WriteLine($"Name: DSC_{photoNumbers:d4}.jpg");
  56.             Console.WriteLine($"Date Taken: {date}");
  57.             Console.WriteLine($"Size: {photoSize}{humanReadableSize}");
  58.             Console.WriteLine($"Resolution: {photoWidth}x{photoHeight} ({resolution})");
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement