Advertisement
koksibg

Photo_Gallery

Jun 9th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.87 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Photo_Gallery
  4. {
  5.     class Photo_Gallery
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             ushort photosNumber = ushort.Parse(Console.ReadLine());
  10.             sbyte day = sbyte.Parse(Console.ReadLine());
  11.             sbyte month = sbyte.Parse(Console.ReadLine());
  12.             ushort year = ushort.Parse(Console.ReadLine());
  13.             sbyte hours = sbyte.Parse(Console.ReadLine());
  14.             sbyte minutes = sbyte.Parse(Console.ReadLine());
  15.             uint photosSizeInByte = uint.Parse(Console.ReadLine());
  16.             ushort widthPhotoInPixeles = ushort.Parse(Console.ReadLine());
  17.             ushort heightPhotoInPixeles = ushort.Parse(Console.ReadLine());
  18.             string size = String.Empty;
  19.             string orientation = String.Empty;
  20.             double photosSize = 0;
  21.             if (photosSizeInByte < 1E+3)
  22.             {
  23.                 photosSize = photosSizeInByte;
  24.                 size = "B";
  25.             }
  26.             else if (photosSizeInByte >= 1E+3 && photosSizeInByte < 1E+6)
  27.             {
  28.                 photosSize = photosSizeInByte / 1E+3;
  29.                 size = "KB";
  30.             }
  31.             else if (photosSizeInByte >= 1E+6 && photosSizeInByte < 1E+9)
  32.             {
  33.                 photosSize = photosSizeInByte / 1E+6;
  34.                 size = "MB";
  35.             }
  36.             orientation = widthPhotoInPixeles > heightPhotoInPixeles ? "landscape" :
  37.                           widthPhotoInPixeles == heightPhotoInPixeles ? "square" : "portrait";
  38.             Console.WriteLine($"Name: DSC_{photosNumber:D4}.jpg");
  39.             Console.WriteLine($"Date Taken: {day:D2}/{ month:D2}/{year:D4} {hours:D2}:{minutes:D2}");
  40.             Console.WriteLine($"Size: {photosSize}{size}");
  41.             Console.WriteLine($"Resolution: {widthPhotoInPixeles}x{heightPhotoInPixeles} ({orientation})");
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement